Skip to content

sojant/GildedRose-python

 
 

Repository files navigation

Gilded Rose Exercise

This is an exercise in using characterization tests and dependency breaking, the shield and the sword.

It is based on the kata "Gilded Rose", named after the inn. The requirements are in the requirements document, next to this document.

Your first task is to get everything building and running in your development environment. Then you add characterization tests and break dependency.

  1. Create a fork so that any changes you push, should you do so, is not mixed with others.
  2. Try run the manual_test.py. Can you tell from the output if the program works?
  3. Run the test test_gilded_rose.py and measure coverage. The script measure-coverage.sh is helpful. Report will be here. See IntelliJ on how to get branch coverage.
  4. Add characterization tests (shield) until you have total branch coverage. Use the requirements document to find test cases. It is not possible to reach 100%, why?
  5. When you reached the good branch coverage, it is time to refactor the code. Start with dependency breaking, the sword.
  6. With the dependency broken, you can refactor your current tests to simplify test data setup.
  7. Time to refactor the current implementation. Keep tests at green all the time. Remember, you may not change the Item class as it is owned by a Goblin.
  8. Next, create a failing test and then implementation, for the new requirement.

Reflections

Note what you learned.

  • Why was the shield used before the sword?
  • Why refactor the current implementation before adding a new requirement?
  • How did you feel when the implementation was put under test?
  • When you refactored the implementation, was readability any of your concern? Why?

Credits

About

The Python version of the GildedRose kata.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 97.3%
  • Shell 2.7%