Skip to main content

Acceptance Test-Driven Development (ATDD)

Acceptance Test-Driven Development (ATDD) is a collaborative software development practice where the entire team—including developers, testers, and business experts—works together to discover and agree on acceptance criteria for a new feature. These criteria, which are defined before any code is written, are written in a simple, domain-focused, and unambiguous language. They serve as both a detailed business requirement and an automated test case that confirms the feature works as intended from a user's perspective. The core idea is to create a shared, executable specification that guarantees the final product meets the business's expectations.

Example: A team is using ATDD to build a feature that allows users to log in with two-factor authentication. Before any development work begins, the team agrees on the following test, written in Gherkin:

Feature: Two-Factor Authentication for Login
As a registered user
I want my account to be secure
So that no one can access it without my phone

  • Scenario: Successful login with two-factor authentication
  • Given: I am on the login page
  • And I have a registered device for two-factor authentication
  • When I enter a valid email and password
  • Then the system should send a one-time code to my registered device
  • And I should be prompted to enter that code

The developers then write the code to make this test pass, ensuring that the feature meets the business requirements from the very start.