What is the first development task in test-driven development?
What is the first development task in test-driven development?
In test-driven development (TDD), the first development task is to write a failing test case for the desired function. This initial test case is intended to define the function's expected behavior before any actual implementation code is written, ensuring that the code development follows the requirements specified by the test. Only after writing this failing test and seeing it fail does the developer proceed to write the minimum amount of code necessary to make the test pass.
Actually, I have re-read the question and I agree it is B. Write a failing test case for a DESIRED Function. i.e. the function hasn't been written yet and therefore the code would fail. It makes sense and fits the TDD defintion.
"B" rite answer
B is correct since writing a failing test is the first task on TDD: Test-Driven-Development - TDD Step 1. Write a test: Write a test that tests for the new class or function that you want to add to your code. Think about the class name and structure you will need in order to call the new capability that doesn’t exist yet—and nothing more. 2. Test Fails 3. Write Code 4. Test Passes 5. Refactor
B should be
The steps of test first development (TFD) are overviewed in the UML activity diagram of Figure 1. The first step is to quickly add a test, basically just enough code to fail.
I think is D. TDD = Write a test, test fails, write some code, test passes, refactor. Therefore, you would start by writing a test which you would hope will eventually pass when the correct code has been written.
D is testing 'existing' code which is not necessary.