200-901 · Question #350
200-901 Question #350: Real Exam Question with Answer & Explanation
The correct answer is B: to demonstrate that the tests fail for expected reasons. In Test-Driven Development (TDD), developers write tests before writing code. The purpose of running the tests before writing code is to demonstrate that the tests fail for expected reasons. This is because the tests are written to test the functionality that the developer is abo
Question
What is the purpose of running tests before writing code in test-driven development?
Options
- Ato find unexpected failures in the tests
- Bto demonstrate that the tests fail for expected reasons
- Cto ensure that the tests pass
- Dto provide proof of the work carried out
Explanation
In Test-Driven Development (TDD), developers write tests before writing code. The purpose of running the tests before writing code is to demonstrate that the tests fail for expected reasons. This is because the tests are written to test the functionality that the developer is about to add to the codebase, and since that functionality does not yet exist, the tests should fail. This is an important step in the TDD process because it confirms that the tests are correctly identifying the missing functionality and that they are not passing due to an error in the tests themselves.
Topics
Community Discussion
No community discussion yet for this question.