coding dojo - golden master technique - approval tests - gilded rose kata-
TRANSCRIPT
![Page 1: Coding Dojo - Golden Master Technique - Approval Tests - Gilded Rose Kata-](https://reader030.vdocuments.mx/reader030/viewer/2022021422/58ecdebe1a28ab06538b45f5/html5/thumbnails/1.jpg)
Coding Dojo
Golden Master TechniqueApproval Tests
Gilded Rose Kata
@AlinPandichi
![Page 2: Coding Dojo - Golden Master Technique - Approval Tests - Gilded Rose Kata-](https://reader030.vdocuments.mx/reader030/viewer/2022021422/58ecdebe1a28ab06538b45f5/html5/thumbnails/2.jpg)
Coding DojoExpectations?
![Page 3: Coding Dojo - Golden Master Technique - Approval Tests - Gilded Rose Kata-](https://reader030.vdocuments.mx/reader030/viewer/2022021422/58ecdebe1a28ab06538b45f5/html5/thumbnails/3.jpg)
Coding Dojo Mindset● We are here to learn● Safe place outside of work● Need to slow down● Focus on doing it right● Noncompetitive, collaborative, fun environment
![Page 4: Coding Dojo - Golden Master Technique - Approval Tests - Gilded Rose Kata-](https://reader030.vdocuments.mx/reader030/viewer/2022021422/58ecdebe1a28ab06538b45f5/html5/thumbnails/4.jpg)
Practice session
● One laptop with a functional dev. env. is connected to a projector
● Two developers pair program on the laptop. The others are watching the code changes.
● Every 7 minutes, one developer leaves the laptop and the next one from the room takes his place.
![Page 5: Coding Dojo - Golden Master Technique - Approval Tests - Gilded Rose Kata-](https://reader030.vdocuments.mx/reader030/viewer/2022021422/58ecdebe1a28ab06538b45f5/html5/thumbnails/5.jpg)
Golden master technique
1. Find the way the system delivers its outputs
2. Find a way to capture the output of the system without changing the production code
3. Generate enough random inputs and persist the tuple input/output
![Page 6: Coding Dojo - Golden Master Technique - Approval Tests - Gilded Rose Kata-](https://reader030.vdocuments.mx/reader030/viewer/2022021422/58ecdebe1a28ab06538b45f5/html5/thumbnails/6.jpg)
Golden master technique
4. Write a system test to check the SUT against the previously persisted data
5. Commit the test6. Check test behaviour and coverage
Outcome: we will have a basic safety net composed of system tests.
![Page 7: Coding Dojo - Golden Master Technique - Approval Tests - Gilded Rose Kata-](https://reader030.vdocuments.mx/reader030/viewer/2022021422/58ecdebe1a28ab06538b45f5/html5/thumbnails/7.jpg)
Approval Tests
ApprovalTests is an open source assertion/verification library to aid unit testing
http://approvaltests.sourceforge.net
![Page 8: Coding Dojo - Golden Master Technique - Approval Tests - Gilded Rose Kata-](https://reader030.vdocuments.mx/reader030/viewer/2022021422/58ecdebe1a28ab06538b45f5/html5/thumbnails/8.jpg)
Gilded Rose Kata
●All items have a SellIn value which denotes the number of days we have to sell the item
●All items have a Quality value which denotes how valuable the item is
●At the end of each day our system lowers both values for every item
![Page 9: Coding Dojo - Golden Master Technique - Approval Tests - Gilded Rose Kata-](https://reader030.vdocuments.mx/reader030/viewer/2022021422/58ecdebe1a28ab06538b45f5/html5/thumbnails/9.jpg)
Gilded Rose Kata
●Once the sell by date has passed, Quality degrades twice as fast
●The Quality of an item is never negative
● "Aged Brie" actually increases in Quality the older it gets
![Page 10: Coding Dojo - Golden Master Technique - Approval Tests - Gilded Rose Kata-](https://reader030.vdocuments.mx/reader030/viewer/2022021422/58ecdebe1a28ab06538b45f5/html5/thumbnails/10.jpg)
Gilded Rose Kata
●The Quality of an item is never more than 50
● "Sulfuras", being a legendary item, never has to be sold or decreases in Quality
![Page 11: Coding Dojo - Golden Master Technique - Approval Tests - Gilded Rose Kata-](https://reader030.vdocuments.mx/reader030/viewer/2022021422/58ecdebe1a28ab06538b45f5/html5/thumbnails/11.jpg)
Gilded Rose Kata
● "Backstage passes", like aged brie, increases in Quality as it's SellIn value approaches; Quality increases by 2 when there are 10 days or less and by 3 when there are 5 days or less but Quality drops to 0 after the concert
![Page 12: Coding Dojo - Golden Master Technique - Approval Tests - Gilded Rose Kata-](https://reader030.vdocuments.mx/reader030/viewer/2022021422/58ecdebe1a28ab06538b45f5/html5/thumbnails/12.jpg)
Gilded Rose Kata
New requirement:
●“Conjured” items degrade in Quality twice as fast as normal items
![Page 13: Coding Dojo - Golden Master Technique - Approval Tests - Gilded Rose Kata-](https://reader030.vdocuments.mx/reader030/viewer/2022021422/58ecdebe1a28ab06538b45f5/html5/thumbnails/13.jpg)
Practice time!
![Page 14: Coding Dojo - Golden Master Technique - Approval Tests - Gilded Rose Kata-](https://reader030.vdocuments.mx/reader030/viewer/2022021422/58ecdebe1a28ab06538b45f5/html5/thumbnails/14.jpg)
Retrospective
● What did you learn today?
● What happened as expected?
● What surprised you?
● What do you plan to use at work?
![Page 15: Coding Dojo - Golden Master Technique - Approval Tests - Gilded Rose Kata-](https://reader030.vdocuments.mx/reader030/viewer/2022021422/58ecdebe1a28ab06538b45f5/html5/thumbnails/15.jpg)
Resources
● https://github.com/apandichi/GildedRoseRefactoringKata
● http://blog.adrianbolboaca.ro/2014/05/goldenmaster/
● http://approvaltests.com/
● http://approvaltests.sourceforge.net
![Page 16: Coding Dojo - Golden Master Technique - Approval Tests - Gilded Rose Kata-](https://reader030.vdocuments.mx/reader030/viewer/2022021422/58ecdebe1a28ab06538b45f5/html5/thumbnails/16.jpg)
Thank you!