Merge and Re-use Product Code across Tests

Use stick-figure testing to modify existing code.

The Change

After you extract similar product code from two different stick-figure tests, refactor to merge them. Now re-use this product code in future stick-figure tests.

The Value Proposition

Our existing stick-figure testing approach is great when we are creating all-new code. However, how do we extend and modify code, even code we just created? Stick-figure testing as we have defined it so far leads to a lot of duplication. The only way to avoid that duplication is to abandon stick-figure testing after the first 1-2 tests and return to TDD or product-first coding — which means we lose the value of stick-figure testing.

Extending stick-figure testing to also support code modification gives the following advantages:

  1. Ensures high test coverage because there is no way to add product code without testing it first.
  2. Reduces duplication while adding new functionality.
  3. Keeps your design as specific and focused as possible while handling today’s functionality.
  4. Easily extends your design when new requirements emerge.
Please log in

This content is only available to students. Please log in to access it.