Coding Dojo - Golden Master Technique - Approval Tests - Gilded Rose Kata-

Preview:

Citation preview

Coding Dojo

Golden Master TechniqueApproval Tests

­Gilded Rose Kata­

@AlinPandichi

Coding DojoExpectations?

Coding Dojo Mindset●  We are here to learn●  Safe place outside of work●  Need to slow down●  Focus on doing it right●  Non­competitive, collaborative, fun environment

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. 

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

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.

Approval Tests

ApprovalTests is an open source assertion/verification library to aid unit testing

http://approvaltests.sourceforge.net

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

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

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

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

Gilded Rose Kata

New requirement:

●“Conjured” items degrade in Quality twice as fast as normal items

Practice time!

Retrospective

●  What did you learn today?

●  What happened as expected?

●  What surprised you?

●  What do you plan to use at work?

Resources

● https://github.com/apandichi/GildedRose­Refactoring­Kata

● http://blog.adrianbolboaca.ro/2014/05/golden­master/

● http://approvaltests.com/

● http://approvaltests.sourceforge.net

Thank you!