Git Product home page Git Product logo

tdd_rediscovered_unittests_exercise's Introduction

TDD Rediscovered Unit Tests Exercise

The Exercise

The Bowling Game Kata

Inspired by Ron Jeffries

The idea is to create a console application that can calculate the traditional score for a Ten-Pin Bowling game.

  • A game consists of ten frames.
  • A frame consists of two tries to knock down ten pins.
  • If the bowler knocks down less than ten pins, that is their score
  • if the bowler knocks down ten pins in two tries, this is a 'spare', and their score is ten + the pins knocked down in the first try from the next frame.
  • If the bowler knocks down ten pins in one try, this is a 'strike', and thier score is ten + the pins knocked down in the next frame
  • If the bowler gets a 'spare' on the last frame, they get an additional try, and their score is ten + the number of pins knocked down
  • If the bowler gets a 'strike' on the last frame, they get an additional two tries, and their score is ten + the number of pins knocked down
  • On any extra tries in the last frame, knocking all the pins down does not count as a 'spare' or a 'strike'

And some scope control

  • We are just calculating the final total, we don't calculate the score for intermediate frames
  • We do not check for valid rolls (i.e. -1 or 11)
  • We don't check the input for additional frames or rolls

For information, the score will be between 0 and 300.

The Rules

The purpose of this kata is to experience the unit testing approach whilst using the following rules:

  • We are writing unit tests. The unit is a class and should be isolated from other classes. We will mock any collaborators of our class.

  • The prompt to write a test is a new method. If we need a method, we write a test before we write the method.

  • We will either work ‘top-down’ establishing their behaviour of our collaborators as we implement the class-under-test, and then implement them with their own tests, or we will work ‘bottom up’ creating the low-level pieces we need, and mock their contract in a high level test

tdd_rediscovered_unittests_exercise's People

Contributors

iancooper avatar

Watchers

 avatar  avatar  avatar

Forkers

alifhughes

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.