CTFL_SYLL_4.0 · Question #193
Which of the following correctly represents a test first approach?
The correct answer is A. First the tests fail then the code is written to pass the tests and this is iterated. A test-first approach involves writing tests before writing the code. In this approach, initially, the tests fail because the corresponding functionality is not yet implemented. Afterward, the code is written or modified to make the tests pass. This cycle is repeated…
Question
Which of the following correctly represents a test first approach?
Options
- AFirst the tests fail then the code is written to pass the tests and this is iterated
- BTests are derived from acceptance criteria and run to check that the code passes these tests
- CApplication behaviour is written in Given/When/Then format and tests are then written and run
- DCode is refactored first then tests are written and run
How the community answered
(34 responses)- A88% (30)
- B3% (1)
- C6% (2)
- D3% (1)
Explanation
A test-first approach involves writing tests before writing the code. In this approach, initially, the tests fail because the corresponding functionality is not yet implemented. Afterward, the code is written or modified to make the tests pass. This cycle is repeated iteratively. This method ensures that the code is developed based on predefined tests and helps in identifying issues early in the development process.
Topics
Community Discussion
No community discussion yet for this question.