1 00:00:06,368 --> 00:00:08,075 - In the last stop and think, 2 00:00:08,075 --> 00:00:10,908 we asked you to do some high-level 3 00:00:11,773 --> 00:00:14,024 acceptance tests for this story. 4 00:00:14,024 --> 00:00:16,186 As Gigi the groomer, I want to record 5 00:00:16,186 --> 00:00:19,459 the arrival and departure time of a client's pet 6 00:00:19,459 --> 00:00:22,024 so that we have it for our records. 7 00:00:22,024 --> 00:00:24,814 We asked you to use the given/when/then format, 8 00:00:24,814 --> 00:00:26,748 and then to do the same tests again 9 00:00:26,748 --> 00:00:31,384 in a tabular format with real and concrete examples. 10 00:00:31,384 --> 00:00:34,351 So the happy path that Lisa and I came up with 11 00:00:34,351 --> 00:00:37,531 is we're showing in this given/when/then example, 12 00:00:37,531 --> 00:00:40,920 given the pet arrived at 11:30 a.m. 13 00:00:40,920 --> 00:00:43,096 it took nine minutes to groom. 14 00:00:43,096 --> 00:00:46,416 When Gigi enters the time at 11 a.m. 15 00:00:46,416 --> 00:00:49,921 for a start and a one p.m. for the end time, 16 00:00:49,921 --> 00:00:52,722 then the grooming time is saved. 17 00:00:52,722 --> 00:00:55,399 Lisa, can you think of a misbehavior, 18 00:00:55,399 --> 00:00:56,732 an unhappy path? 19 00:00:57,786 --> 00:00:59,644 - Sure, what if Gigi makes a mistake 20 00:00:59,644 --> 00:01:02,064 when she's entering the times, right? 21 00:01:02,064 --> 00:01:05,429 So given that the pet arrived at 10 o' clock, 22 00:01:05,429 --> 00:01:08,269 took 45 minutes to groom it, when Gigi enters 23 00:01:08,269 --> 00:01:12,563 10 o' clock for a start time and 9:30 for the end time, 24 00:01:12,563 --> 00:01:14,228 then she gets an appropriate error message 25 00:01:14,228 --> 00:01:17,149 because the end time is earlier than the start time 26 00:01:17,149 --> 00:01:18,908 and she has to correct the time. 27 00:01:18,908 --> 00:01:20,623 - Okay, that's a good example. 28 00:01:20,623 --> 00:01:23,131 - But the problem is, we can think of lots 29 00:01:23,131 --> 00:01:25,198 and lots of these examples, right? 30 00:01:25,198 --> 00:01:26,893 And so there are some cases where it 31 00:01:26,893 --> 00:01:28,458 would be awkward to just keep writing 32 00:01:28,458 --> 00:01:31,595 these long tests, and I think this is 33 00:01:31,595 --> 00:01:35,724 an example where it would work better in a tabular format. 34 00:01:35,724 --> 00:01:38,658 - So we've got the start of a tabular format 35 00:01:38,658 --> 00:01:39,860 with some examples. 36 00:01:39,860 --> 00:01:41,707 We have our start time, our end time, 37 00:01:41,707 --> 00:01:43,340 our expected result. 38 00:01:43,340 --> 00:01:46,329 So if I was a tester, I might write these 39 00:01:46,329 --> 00:01:48,805 down on a piece of paper and take them 40 00:01:48,805 --> 00:01:50,732 over to the programmer after and say, 41 00:01:50,732 --> 00:01:52,593 hey, this is what I'm thinking. 42 00:01:52,593 --> 00:01:54,355 And it's the start of that discussion 43 00:01:54,355 --> 00:01:55,772 to automate them. 44 00:01:56,625 --> 00:02:00,243 So our happy path starts at 11:30, 45 00:02:00,243 --> 00:02:03,081 it ended at one o' clock, perfect grooming. 46 00:02:03,081 --> 00:02:05,581 90 minutes, successful change. 47 00:02:06,956 --> 00:02:11,507 - Yeah, and started at 11:30, maybe we want to use 48 00:02:11,507 --> 00:02:15,373 a 24 hour time format, so we say 1300 49 00:02:15,373 --> 00:02:17,785 for the end time, 90 minutes, and then 50 00:02:17,785 --> 00:02:20,653 saved in that time format. 51 00:02:20,653 --> 00:02:21,566 - Right. 52 00:02:21,566 --> 00:02:22,848 And this would be where, if I took this 53 00:02:22,848 --> 00:02:24,454 to the programmer or we're having a 54 00:02:24,454 --> 00:02:27,092 collaborative discussion, he might say 55 00:02:27,092 --> 00:02:28,788 why would we ever do that? 56 00:02:28,788 --> 00:02:30,403 - Yeah, doing different time formats 57 00:02:30,403 --> 00:02:33,928 might be just extra fluff that we don't really need. 58 00:02:33,928 --> 00:02:35,220 - And so maybe we have to start 59 00:02:35,220 --> 00:02:38,365 checking our time formats, right? 60 00:02:38,365 --> 00:02:40,469 That's another kind of test we have to do. 61 00:02:40,469 --> 00:02:42,355 But maybe not for this particular thing. 62 00:02:42,355 --> 00:02:46,380 - I wonder if it would be easier for the groomers 63 00:02:46,380 --> 00:02:48,304 to just have to put the start time 64 00:02:48,304 --> 00:02:49,727 and then how long did it take and 65 00:02:49,727 --> 00:02:52,104 they don't even have to calculate the end time. 66 00:02:52,104 --> 00:02:52,961 - Oh. 67 00:02:52,961 --> 00:02:56,522 Okay, so then the end time is calculated 68 00:02:56,522 --> 00:02:58,439 versus that other time. 69 00:03:00,276 --> 00:03:01,899 That could be interesting. 70 00:03:01,899 --> 00:03:05,732 So maybe we take and say, this is the results. 71 00:03:09,194 --> 00:03:11,849 And maybe this is the time taken. 72 00:03:11,849 --> 00:03:13,330 - Yeah, yeah. 73 00:03:13,330 --> 00:03:16,358 - Okay, so we're talking, we're having a discussion. 74 00:03:16,358 --> 00:03:17,738 - Right, right. 75 00:03:17,738 --> 00:03:20,692 - We might be able to show error messages. 76 00:03:20,692 --> 00:03:24,397 Like what happens if this is your unhappy path example. 77 00:03:24,397 --> 00:03:27,005 - The end time earlier than the start time. 78 00:03:27,005 --> 00:03:30,833 And we could have really complicated scenarios too. 79 00:03:30,833 --> 00:03:33,934 So let's say Gigi works on two dogs at the same time. 80 00:03:33,934 --> 00:03:36,567 Maybe she alternates letting one dry 81 00:03:36,567 --> 00:03:38,234 while she starts the other one. 82 00:03:38,234 --> 00:03:39,920 So how are we gonna handle that? 83 00:03:39,920 --> 00:03:41,182 'Cause they're overlapping, so 84 00:03:41,182 --> 00:03:43,137 we definitely need to talk to the product owner 85 00:03:43,137 --> 00:03:46,019 and the developers about that one. 86 00:03:46,019 --> 00:03:49,882 - So the acceptance tests really give you concrete... 87 00:03:49,882 --> 00:03:53,982 It makes you really understand the story 88 00:03:53,982 --> 00:03:57,077 to help get that shared understanding 89 00:03:57,077 --> 00:03:59,182 to give you examples of all the different 90 00:03:59,182 --> 00:04:02,169 types of things that you may want to test. 91 00:04:02,169 --> 00:04:05,511 And it really helps give you that start 92 00:04:05,511 --> 00:04:07,250 about what code to write. 93 00:04:07,250 --> 00:04:08,242 - Yeah, exactly. 94 00:04:08,242 --> 00:04:10,200 The developers can start working on the story 95 00:04:10,200 --> 00:04:11,695 and have a really good picture 96 00:04:11,695 --> 00:04:13,583 of what they need to deliver. 97 00:04:13,583 --> 00:04:15,550 - And you can automate these? 98 00:04:15,550 --> 00:04:17,802 And then they code 'til they pass. 99 00:04:17,802 --> 00:04:18,802 - Yay. - Yay. 100 00:04:20,173 --> 00:04:21,916 - Let's review what we've covered in 101 00:04:21,916 --> 00:04:24,972 this lesson on testing early. 102 00:04:24,972 --> 00:04:27,961 We talked about how to apply your testing mindset early 103 00:04:27,961 --> 00:04:30,880 to the business problem and how to solve it. 104 00:04:30,880 --> 00:04:32,894 And we talked about using conversations wisely 105 00:04:32,894 --> 00:04:36,390 at the appropriate level of detail. 106 00:04:36,390 --> 00:04:38,227 - [Blonde woman] Guiding development with examples is 107 00:04:38,227 --> 00:04:41,037 a very powerful way to gain shared understanding 108 00:04:41,037 --> 00:04:42,954 of what is being built. 109 00:04:43,861 --> 00:04:46,404 You need the story, conversation, 110 00:04:46,404 --> 00:04:50,885 and the acceptance tests to get a full understanding 111 00:04:50,885 --> 00:04:54,079 of the specifications or the requirements. 112 00:04:54,079 --> 00:04:56,115 - Some or all of these will become 113 00:04:56,115 --> 00:04:58,013 automated regression tests. 114 00:04:58,013 --> 00:05:01,415 We'll talk about that in the next lesson on automation.