1 00:00:06,753 --> 00:00:09,866 - Now we'll dive deeper into the left side of the quadrants. 2 00:00:09,866 --> 00:00:12,023 The quadrant one and two tests. 3 00:00:12,023 --> 00:00:15,904 These are tests that are written before or during coding, 4 00:00:15,904 --> 00:00:18,699 and they help us build the right thing. 5 00:00:18,699 --> 00:00:20,557 First, let's look at a case study 6 00:00:20,557 --> 00:00:22,064 that we would like to use for some examples 7 00:00:22,064 --> 00:00:25,018 to illustrate these quadrant tests. 8 00:00:25,018 --> 00:00:28,319 Let's pretend we're a delivery team and we're working 9 00:00:28,319 --> 00:00:31,184 with the Positively Perfect Pet Salon, 10 00:00:31,184 --> 00:00:33,307 that's our example project for this course. 11 00:00:33,307 --> 00:00:37,609 They want some new features for their web application. 12 00:00:37,609 --> 00:00:39,419 Here's what the salon has in mind. 13 00:00:39,419 --> 00:00:41,722 As we go through the quadrants, we're gonna give examples 14 00:00:41,722 --> 00:00:44,939 of how we apply tests in different quadrants 15 00:00:44,939 --> 00:00:47,568 to these features as we develop them. 16 00:00:47,568 --> 00:00:49,774 Let's talk about quadrant one tests: 17 00:00:49,774 --> 00:00:52,416 the technology-facing tests that guide development. 18 00:00:52,416 --> 00:00:53,705 Once again, these numbers 19 00:00:53,705 --> 00:00:55,941 we've assigned the quadrants are arbitrary. 20 00:00:55,941 --> 00:00:58,303 If you're building a web or mobile application, 21 00:00:58,303 --> 00:01:00,280 you're probably gonna start in quadrant two. 22 00:01:00,280 --> 00:01:02,378 For example, you might start drawing paper mock-ups 23 00:01:02,378 --> 00:01:03,616 and testing with those. 24 00:01:03,616 --> 00:01:06,233 So, different types of applications and products 25 00:01:06,233 --> 00:01:07,829 will start in different quadrants. 26 00:01:07,829 --> 00:01:09,978 Once we start writing the code, 27 00:01:09,978 --> 00:01:12,327 we're doing quadrant one tests. 28 00:01:12,327 --> 00:01:14,059 Now let's talk about some of those tests 29 00:01:14,059 --> 00:01:15,694 that we do in quadrant one. 30 00:01:15,694 --> 00:01:18,115 These tests help design the code. 31 00:01:18,115 --> 00:01:19,894 They're focused on internal quality, 32 00:01:19,894 --> 00:01:23,684 and that's what allows us to have our sustainable pace 33 00:01:23,684 --> 00:01:25,629 and fearlessly change our code 34 00:01:25,629 --> 00:01:27,776 as we need to add new features. 35 00:01:27,776 --> 00:01:28,722 In agile development, 36 00:01:28,722 --> 00:01:31,992 most teams use test-driven development. 37 00:01:31,992 --> 00:01:33,915 They write a small test, 38 00:01:33,915 --> 00:01:36,431 or some small, tiny, increment of functionality, 39 00:01:36,431 --> 00:01:38,266 write the code that makes that test pass, 40 00:01:38,266 --> 00:01:40,188 and keep iterating over that 41 00:01:40,188 --> 00:01:43,429 until that particular story is complete. 42 00:01:43,429 --> 00:01:45,586 We wanna make sure all these different small, 43 00:01:45,586 --> 00:01:48,751 incremental components we have created work together. 44 00:01:48,751 --> 00:01:51,344 So, developers write component tests. 45 00:01:51,344 --> 00:01:54,258 And this is the verifying the architecture of our system. 46 00:01:54,258 --> 00:01:56,891 Making sure that everything works together correctly. 47 00:01:56,891 --> 00:02:00,461 For our pet salon, an example of a unit test might be 48 00:02:00,461 --> 00:02:04,488 making sure that the dates entered to book an appointment 49 00:02:04,488 --> 00:02:06,365 are in a valid format. 50 00:02:06,365 --> 00:02:09,357 And that unit test will influence 51 00:02:09,357 --> 00:02:13,524 how we decide to do our date format and our date creation. 52 00:02:14,411 --> 00:02:17,153 What do we do with these kind of quadrant one tests? 53 00:02:17,153 --> 00:02:20,105 Again, we're talking about internal quality. 54 00:02:20,105 --> 00:02:23,000 These tests are the strong foundation 55 00:02:23,000 --> 00:02:25,190 for the higher level tests that we're going to do 56 00:02:25,190 --> 00:02:27,097 in other products. 57 00:02:27,097 --> 00:02:30,430 It helps us write robust and maintainable code 58 00:02:30,430 --> 00:02:31,710 that's easy to test. 59 00:02:31,710 --> 00:02:34,616 Make it easy to automate the tests. 60 00:02:34,616 --> 00:02:36,815 Provides a safety net for refactoring, 61 00:02:36,815 --> 00:02:38,918 so we can change the code and if we break something, 62 00:02:38,918 --> 00:02:40,838 our tests will tell us. 63 00:02:40,838 --> 00:02:43,582 And we get this fast feedback about regression failures 64 00:02:43,582 --> 00:02:46,180 from our continuous integration. 65 00:02:46,180 --> 00:02:47,882 Quadrant one tests become the foundation 66 00:02:47,882 --> 00:02:50,639 for our other testing, that give us confidence 67 00:02:50,639 --> 00:02:53,189 to release our software product. 68 00:02:53,189 --> 00:02:56,441 And they become part of the regression suite, again, 69 00:02:56,441 --> 00:02:59,657 that lets us fearlessly change our code going forward. 70 00:02:59,657 --> 00:03:02,707 Without these tests, it's really gonna be hard to succeed 71 00:03:02,707 --> 00:03:04,428 in all the other quadrants. 72 00:03:04,428 --> 00:03:08,026 So we urge you, when you're starting with test automation, 73 00:03:08,026 --> 00:03:10,711 to start with quadrant one tests. 74 00:03:10,711 --> 00:03:12,566 Now let's move on to quadrant two. 75 00:03:12,566 --> 00:03:15,481 We often start our testing and our test automation 76 00:03:15,481 --> 00:03:18,592 in quadrant two, and we get the whole team involved, 77 00:03:18,592 --> 00:03:21,737 both on the business side and the technical side. 78 00:03:21,737 --> 00:03:23,808 Let's talk about some of those. 79 00:03:23,808 --> 00:03:27,465 In quadrant two, we're also doing test-first coding, 80 00:03:27,465 --> 00:03:30,094 but from the business perspective. 81 00:03:30,094 --> 00:03:32,503 So we're asking questions, we're getting examples 82 00:03:32,503 --> 00:03:34,671 from the business of how something should behave. 83 00:03:34,671 --> 00:03:37,771 We're maybe drawing paper prototypes. 84 00:03:37,771 --> 00:03:39,516 We're writing the test first 85 00:03:39,516 --> 00:03:42,074 so that the developers know what to code. 86 00:03:42,074 --> 00:03:43,220 We have enough information 87 00:03:43,220 --> 00:03:45,727 to start writing code with confidence. 88 00:03:45,727 --> 00:03:47,955 If we're doing a mobile or a web application, 89 00:03:47,955 --> 00:03:49,569 something with a user interface, 90 00:03:49,569 --> 00:03:51,491 we'll want wire frames or mock-ups 91 00:03:51,491 --> 00:03:54,843 that show us the page layout, the arrangement of content, 92 00:03:54,843 --> 00:03:57,590 all the different elements of EUI, how we're gonna navigate. 93 00:03:57,590 --> 00:03:59,755 And again, we can just test this with paper first, 94 00:03:59,755 --> 00:04:01,954 and make quicker decisions 95 00:04:01,954 --> 00:04:04,314 before we start spending time writing code. 96 00:04:04,314 --> 00:04:05,896 And we do similar activities 97 00:04:05,896 --> 00:04:07,919 for the non-user interface features, 98 00:04:07,919 --> 00:04:11,396 like the API or doing batch processes or data warehouse. 99 00:04:11,396 --> 00:04:13,388 We can always talk about these things 100 00:04:13,388 --> 00:04:15,956 before we would actually write the code. 101 00:04:15,956 --> 00:04:18,706 So, in the case of our pet salon, 102 00:04:19,545 --> 00:04:21,753 we asked Sally the salon owner, 103 00:04:21,753 --> 00:04:23,776 what's the business problem that you want to solve 104 00:04:23,776 --> 00:04:26,559 with these new features in your web application? 105 00:04:26,559 --> 00:04:29,587 And what she wants is to save the time they spend 106 00:04:29,587 --> 00:04:31,676 answering the phone to book appointments. 107 00:04:31,676 --> 00:04:34,407 So, big interruption, it takes a lot of time. 108 00:04:34,407 --> 00:04:36,867 They want to get away from that manually scheduling, 109 00:04:36,867 --> 00:04:39,765 and they want clients to be able to use the application 110 00:04:39,765 --> 00:04:42,748 to schedule their own appointments and get confirmation. 111 00:04:42,748 --> 00:04:45,477 And so we sit down with Sally, and maybe other people 112 00:04:45,477 --> 00:04:48,139 at the pet salon, and start drawing on a whiteboard 113 00:04:48,139 --> 00:04:51,172 or drawing on paper prototypes to work through examples. 114 00:04:51,172 --> 00:04:53,532 What's the purpose of quadrant two tests. 115 00:04:53,532 --> 00:04:55,964 We're talking about external quality. 116 00:04:55,964 --> 00:04:57,628 How the business defines quality. 117 00:04:57,628 --> 00:05:00,298 They accept this criteria that they set out 118 00:05:00,298 --> 00:05:02,555 for each feature and each story. 119 00:05:02,555 --> 00:05:05,009 We're talking with them about the business problems 120 00:05:05,009 --> 00:05:08,317 that they are trying to solve, and helping them with those. 121 00:05:08,317 --> 00:05:10,595 Quadrant two is really where agile development 122 00:05:10,595 --> 00:05:12,884 is different from other types of development. 123 00:05:12,884 --> 00:05:16,456 So rather than working with written requirements, 124 00:05:16,456 --> 00:05:18,757 we're specifying executable tests 125 00:05:18,757 --> 00:05:20,936 that will tell us what code to write. 126 00:05:20,936 --> 00:05:24,240 We're capturing examples and turning them into tests. 127 00:05:24,240 --> 00:05:26,615 And we're building that shared understanding. 128 00:05:26,615 --> 00:05:30,019 Everyone on our business team, everyone on our delivery team 129 00:05:30,019 --> 00:05:32,065 knows how each feature should behave, 130 00:05:32,065 --> 00:05:34,399 and we have enough information to start coding 131 00:05:34,399 --> 00:05:35,859 and building the right thing. 132 00:05:35,859 --> 00:05:38,091 And we wanna focus on collaboration. 133 00:05:38,091 --> 00:05:40,725 We'll talk later in the course 134 00:05:40,725 --> 00:05:43,401 about different ways to have conversations 135 00:05:43,401 --> 00:05:45,160 and involve the right people 136 00:05:45,160 --> 00:05:47,686 to get this shared understanding.