What would you do?
You are a brave adventurer/coder embarking on a new quest. You are about to write some code. What do you do first? Read through these descriptions and choose the one that best matches how you would behave. Follow the link to see the possible consequences.
Option A
Start by opening a new file in a code editor. Begin declaring a test case. Refer back to the requirements document and pick the first thing it refers to to turn into a test. Go back to the editor and write that test case.
If you choose this option, go here to see the consequences.
Option B
Start by reading the requirements carefully and sketching ideas in a notebook or on a whiteboard together with a colleague. When you have understood more about what’s needed, note down some test cases you’ll need. Explore a few different avenues and aspects of the problem and expand your test case list. Analyse the list and pick the simplest, smallest one to begin with. Open your code editor and write that test.
If you choose this option, go here to see the consequences.
Option C
Start by reading the requirements carefully. Every time you find something that will need a test case, highlight it. Spend considerable time analysing each highlighted case and identifying edge cases, invariants etc. When you’re ready, go to a code editor and declare a test case for each thing you highlighted. Define custom assertions and supporting fixture code as needed. Comment out all but the first test case.
If you choose this option, go here to see the consequences.
Option D
Start by reading the requirements carefully. When you’ve understood them, write code to fulfill the requirements. When you think everything is working, write a test case that checks the code works. Continue adding test cases one by one checking each passes as you finish it.
If you choose this option, go here to see the consequences.