Format: Live coding Speaker: Xavier Nopre

Issue to solve: You need to build something that will give you the price of a cart based on:

  • Quantity of item
  • Unit price of the item
  • Tax %

The speaker walked through the fundamentals of Test-Driven Development (TDD) via a live coding example, focusing not just on how to write tests, but on the mindset behind the practice.


Structure of a Test

Each test should follow three clear steps:

  1. Prepare: Set up context and data.

  2. Trigger the action: Call the function or behavior you’re testing.

  3. Verify: Assert the expected outcome.

In TDD though, you actually start by writing the action and the verification first, then backfill the preparation.


Workflow & Good Practices

  • Write the full test first — including action and assertions — even if the code it calls doesn’t exist yet.

  • Use your IDE’s tooling to quickly generate the necessary code stubs to get a compiling (but failing) test.

  • Then, write the minimal amount of code needed to make the test pass.

  • Keep each test extremely focused:
    📌 One case per test — avoid multi-scenario tests.
    📌 Focus on the main, nominal behavior first, not edge or error cases.


TDD Is a Practice and a Mindset

The speaker insisted that TDD isn’t just a technical method — it’s a way of thinking:

  • Focus on what you need and how it’s used, not how it’s implemented.

  • TDD takes time and discipline, but it’s an investment in code quality and confidence.

  • Approach it progressively:
    📌 Start with new code.
    📌 Begin on obvious, easy cases to build comfort.
    📌 Integrate it gradually into the team’s workflow.


Team Practice & Training

To get better at TDD:

  • Practice regularly with katas and coding dojos.

  • For example, revisit this price calculation example together.

  • Build a collective culture around writing tests first.


Key Takeaway

TDD isn’t just about tests — it’s a tool for driving better design decisions through code. It requires focus, restraint (one test at a time), and a shift in mindset from fixing problems to building reliable, intentional software step by step.