Certopolis

ISTQB Certified Tester Foundation Level

TDD vs ATDD vs BDD and shift left for ISTQB CTFL

TDD, ATDD and BDD all define tests before the code is written. TDD directs coding through test cases. ATDD derives tests from acceptance criteria. BDD writes the desired behaviour as test cases in simple natural language, usually Given/When/Then. ISTQB's CTFL v4.0 syllabus says each one applies early testing and follows shift left.

How do the three test-first approaches differ?

In test-driven development (TDD), test cases steer the coding, taking the place of extensive up-front software design. The order is: write the tests, write code that satisfies them, then refactor both the tests and the code.

In acceptance test-driven development (ATDD), the tests come from the acceptance criteria and are worked out during system design. They exist before the matching part of the application is built.

Behavior-driven development (BDD) states how the application should behave as test cases written in simple natural language that stakeholders can follow, usually in the Given/When/Then format. Those test cases should then be translated automatically into executable tests.

All three support an iterative development model. In all three, the tests may be kept as automated tests that protect code quality during later changes and refactoring.

What does shift left mean?

Shift left is another name for the early testing principle: testing moves to an earlier point in the SDLC. Testers do not wait until the code exists or the components have been integrated. Later testing still has to be done: shift left is no reason to neglect it.

The syllabus lists practices that achieve it. Review specifications from a tester's perspective, which often finds ambiguities, gaps and inconsistencies. Write test cases before the code and run the code in a test harness while it is being implemented. Use continuous integration, and better still continuous delivery, so that source code arrives in the repository with automated component tests and gets fast feedback. Finish static analysis of the source code before dynamic testing starts, or run it automatically. Where possible, begin non-functional testing as early as component testing.

Shift left can cost more training, effort or money early in the process. It is expected to save effort or cost later. It also needs stakeholders who are convinced of the idea.

Where the exam catches people

  • Believing TDD starts from acceptance criteria: that is ATDD. TDD uses test cases to direct the coding.
  • Believing the TDD cycle ends when the tests pass: the last step is refactoring the tests and the code.
  • Believing BDD scenarios are documentation only: they should be translated automatically into executable tests.
  • Believing shift left makes system testing or other late testing redundant: shift left moves testing earlier but does not justify neglecting later testing.
  • Believing shift left covers only reviews: it also includes writing tests before code, CI with component tests, static analysis and early non-functional testing.

Written from these sources

Try 3 questions on this

Pick an answer to see why each option is right or wrong.

  1. Which of the following gives the order of work in test-driven development (TDD)? Select ONE option.

    Right. In the game that’s Renown for your Testing Throughout the Software Development Lifecycle building.

    Not that one: D is right. In the game your Testing Throughout the Software Development Lifecycle building would lose a little Renown, and this question would come back later.

  2. Which of the following BEST describes behavior-driven development (BDD)? Select ONE option.

    Right. In the game that’s Renown for your Testing Throughout the Software Development Lifecycle building.

    Not that one: D is right. In the game your Testing Throughout the Software Development Lifecycle building would lose a little Renown, and this question would come back later.

    Show the full explanation and doc quotes

    The librarian can confirm that sentence without reading any code, and the developers then wire it up so the very same sentence runs as a test. Readable behaviour that also executes is what the key describes.

    Written from istqb.org/wp-content/uploads/2024/11/ISTQB_CTFL_Syllabus_v4.0.1.pdf

  3. A project has adopted shift left: testers now review specifications and write test cases before the code. The project manager proposes to drop the system test phase, arguing that the defects will already have been found. Which of the following is the BEST response? Select ONE option.

    Right. In the game that’s Renown for your Testing Throughout the Software Development Lifecycle building.

    Not that one: C is right. In the game your Testing Throughout the Software Development Lifecycle building would lose a little Renown, and this question would come back later.

    Show the full explanation and doc quotes

    System testing still has its own objectives.

    Written from istqb.org/wp-content/uploads/2024/11/ISTQB_CTFL_Syllabus_v4.0.1.pdf

Ask for something