From the course: Agile Software Development: Refactoring

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Start writing pin-down tests

Start writing pin-down tests

From the course: Agile Software Development: Refactoring

Start my 1-month free trial

Start writing pin-down tests

- [Narrator] Our first step in working with legacy code is to add pin-down tests so let's add our first pin-down test. We'll start by examining the source code that the kata author gave us and see how it works. So at line 11 we're creating an array of items, at line 12 creating an instance of the Gilded Rose app passing in that array of items. In line 13 calling updateQuality and line 14 making an assertion about the current state of the items in the array. We'll follow that pattern as we write our pin-down tests. And now to guide us on the first pin-down test to write let's take look at the requirements again. So the first requirement says all items have a SellIn value that denotes the number of days we have left to sell the item. All items have a Quality value that denotes how valuable the item is and at the end of each day our system lowers both values for every item. Let's write a pin-down test for that behavior. We'll go back to Gilded Rose test at line 16 1/2 type @test public…

Contents