1
00:00:05,940 --> 00:00:11,400
Hey everybody what's going on is Caleb with Def slopes dot com and if you're anything like me when you

2
00:00:11,400 --> 00:00:16,290
were in school or I guess if you are in school right now you hated taking tests.

3
00:00:16,290 --> 00:00:18,080
Don't worry I hated them too.

4
00:00:18,600 --> 00:00:24,660
And the research has actually shown that most testing done in schools is not totally accurate or complete

5
00:00:24,660 --> 00:00:28,400
picture of student learning understanding or knowledge.

6
00:00:28,450 --> 00:00:34,130
Ok but what makes a good test then what would accurately test something.

7
00:00:34,170 --> 00:00:41,060
Well in layman's terms a good test is one that accurately examines what it's supposed to test.

8
00:00:41,070 --> 00:00:45,480
OK one that you've actually carefully thought out and one that produces the intended result.

9
00:00:45,480 --> 00:00:49,950
That's why it's really really important to write good clean unit tests.

10
00:00:49,950 --> 00:00:54,540
Otherwise they might not end up testing what you intend for them to test or you might even be tricked

11
00:00:54,870 --> 00:01:00,030
into thinking that they work because they might pass but not actually test what you want.

12
00:01:00,030 --> 00:01:02,710
Causing all kinds of problems for yourself.

13
00:01:02,730 --> 00:01:05,430
So how do you write a good unit test.

14
00:01:05,430 --> 00:01:10,560
Well I have an acronym for you to remember and it's a trip a trip.

15
00:01:10,560 --> 00:01:15,330
What I mean is that A stands for automatic test should be automatic.

16
00:01:15,330 --> 00:01:19,350
They should automatically run quickly and pass or fail quickly.

17
00:01:19,430 --> 00:01:19,800
OK.

18
00:01:19,830 --> 00:01:24,250
Automatic t in a trip stands for thorough.

19
00:01:24,840 --> 00:01:32,070
You should make sure that you test as many different scenarios and situations as possible like the initialization

20
00:01:32,130 --> 00:01:35,380
of data models network request et cetera et cetera.

21
00:01:35,610 --> 00:01:39,030
Thorough K R is for repeatable.

22
00:01:39,030 --> 00:01:45,060
This means that your test should be able to run the same way and produce the same result every single

23
00:01:45,060 --> 00:01:45,420
time.

24
00:01:45,420 --> 00:01:46,310
That's the point right.

25
00:01:46,310 --> 00:01:49,550
They should be able to be very consistent.

26
00:01:49,620 --> 00:01:55,540
I is for independent OK a good test should only test one thing at a time.

27
00:01:55,620 --> 00:01:57,910
Multiple assertions are OK.

28
00:01:57,960 --> 00:02:02,610
Right you're asserting that something is true or false or nil or equal to another thing.

29
00:02:02,610 --> 00:02:08,310
Multiple assertions are fine as long as they're testing the same one feature or behavior test should

30
00:02:08,310 --> 00:02:15,630
also not rely upon other tests in order to run P is for professional follow the same good standards

31
00:02:15,630 --> 00:02:19,120
for writing tests that you would for writing production code.

32
00:02:19,140 --> 00:02:23,680
Make sure your code is as readable clean and efficient as possible.

33
00:02:23,990 --> 00:02:29,430
A trip automatic thorough repeatable independent professional.

34
00:02:29,610 --> 00:02:33,290
That is how you ensure that you've written a good unit test.

35
00:02:33,300 --> 00:02:35,370
This is Caleb with Debb slopes com.
