In-Class Exercise
Chapter 4 TDD Exercise

Introduction to Software Testing, Edition 2
Ammann & Offutt

This is an in-class group exercise based on homework 3. In homework 3, you used a TDD process to extend the Calc class. Now we are going to outline the addition of one more feature to Calc, and explore the ramifcations in small groups, and as a class. You will do one step at a time in your small groups. Then we will discuss the step as a class before continuing.

  1. Create a user story to allow users to save a value in memory.

  2. Outline one TDD test for the user story. (By “outline,” I mean write down the essential statements, but without a full JUnit structure.)

  3. Talk about what needs to be changed in the Calc class for that test. (Don’t implement the changes.)

  4. Repeat steps 2 & 3 until we are satisfied.

  5. What refactoring is needed?