nerdexam
PMI

PMI-ACP · Question #412

What is the purpose of running a test before you develop the code?

The correct answer is B. To ensure it fails. This question describes the first step of Test-Driven Development (TDD), a core Agile and XP practice. In TDD, you write a test before writing any production code. Running the test first should confirm it FAILS - this is critical because it validates that the test is actually…

Submitted by manish99· Apr 18, 2026Problem Detection and Resolution

Question

What is the purpose of running a test before you develop the code?

Options

  • ATo complete all test cases
  • BTo ensure it fails
  • CTo ensure it passes
  • DTo be cross-functional

How the community answered

(45 responses)
  • A
    4% (2)
  • B
    93% (42)
  • C
    2% (1)

Explanation

This question describes the first step of Test-Driven Development (TDD), a core Agile and XP practice. In TDD, you write a test before writing any production code. Running the test first should confirm it FAILS - this is critical because it validates that the test is actually testing something meaningful and that the test infrastructure is working. A test that passes before the code is written is either testing the wrong thing or the functionality already exists. Only after confirming the test fails do you write the minimum code to make it pass (Red-Green-Refactor cycle).

Topics

#Test-Driven Development#Agile Testing#Engineering Practices

Community Discussion

No community discussion yet for this question.

Full PMI-ACP Practice