While practicing Test-Driven Development, what is done after the test fails? (choose the best answer)
Suggested Answer: B
Get Premium PSD Questions
as Interactive Web-Based Practice Test or PDF
Real Exam Format
Detailed Explanations
Instant Access
Get Your Practice Test
Test-Driven Development (TDD) involves writing a failing test first, then writing the minimal code needed to make the test pass. This iterative process ensures code correctness and encourages better design.
31 comments · newest first
SU
Suzan
10 months ago
Implementing the functionality right away seems risky.
WE
Wei
10 months ago
I thought you just run it again to confirm the failure first?
TU
Tu
10 months ago
Totally agree, option B is the way to go!
CH
Chandra
10 months ago
Wait, why would you refactor the test? That seems off.
RO
Roxanne
10 months ago
You usually write the minimum code to pass the test.
MI
Mitzie
11 months ago
I recall a similar question where we discussed refactoring tests, but I think that's more about improving code after it passes, not right after a failure.
MA
Marjory
11 months ago
I feel like we might need to implement the required functionality after a failure, but I'm not completely confident about the order of steps.
FI
Filiberto
11 months ago
I'm not entirely sure, but I remember something about running the test again to confirm it fails before doing anything else.
KI
Kimi
11 months ago
I think after a test fails, we should write the minimum amount of product code to satisfy the test, right? That sounds like what we practiced.
PE
Penney
12 months ago
I remember learning about this in class. After the test fails, the next step is to write the minimum amount of code to satisfy the test. So the answer is definitely B.
ZO
Zoila
12 months ago
I'm not too familiar with test-driven development, so I'm not sure about this one. I might go with D and just implement the required functionality, but I'm not certain that's the best approach.
MA
Maryann
12 months ago
Okay, I got this. The key is to write the minimum amount of code to pass the test, so the answer has to be B. That's the whole point of test-driven development.
GA
Galen
1 year ago
Hmm, I'm a little confused on this one. I think it might be C - run the test again to make sure it really fails. But I'm not totally confident.
GI
Gianna
1 year ago
I'm pretty sure the answer is B. After the test fails, the next step is to write the minimum amount of product code to satisfy the test.
KI
Kirk
1 year ago
I'm going with B. Anything else just feels like you're not following the principles of TDD.
SH
Shakira
1 year ago
Haha, E is a good one! Refactoring the test so the code passes? That's like cheating, right?
KA
Kaitlyn
1 year ago
C? Really? Why would you run the test again if it already failed? That's a waste of time!
AL
Aleisha
1 year ago
E) Refactor the test so the code passes.
LA
Lashawn
1 year ago
D) Implement the required functionality.
JE
Jerry
1 year ago
B) Write the minimum amount of product code to satisfy the test.
LE
Leota
1 year ago
Hmm, I'm torn between B and D. Isn't the whole point of TDD to write the simplest code first?
FL
Florinda
1 year ago
B) Yes, the idea is to write the simplest code that makes the test pass.
GE
Gerald
1 year ago
D) Implement the required functionality.
MI
Mi
1 year ago
B) Write the minimum amount of product code to satisfy the test.
WI
Winfred
1 year ago
B is the way to go! You don't want to overengineer, just write the minimum code to make the test pass.
AN
Annalee
1 year ago
User 3: D) Implement the required functionality.
ME
Merri
1 year ago
User 2: C) Run it again to make sure it really fails.
WI
William
1 year ago
User 1: B) Write the minimum amount of product code to satisfy the test.
SA
Sabra
1 year ago
But shouldn't we also consider C) Run it again to make sure it really fails before moving on?
FE
Felix
1 year ago
I agree with Tonette, that's what you do after the test fails.
TO
Tonette
1 year ago
I think the answer is B) Write the minimum amount of product code to satisfy the test.