re: Add unit tests on a project already in progress VIEW POST

VIEW PARENT COMMENT VIEW FULL DISCUSSION
 

That is why you use integration tests on the old code and unit tests on the new one you add or refactor because, as you said, unit tests on legacy unmaintainable code is madness.

 

Right, but that involves writing the integration test (assuming one doesn't exist). This gives the developer three options:

1. Write the Integration Test to refactor the code to write the unit test.
The "best" option but most time consuming.

2. Write the Integration Test instead of the unit test.
The code is at least tested, but the test is brittle and slow.

3. Fix the bug and skip the unit test (just this one time!)
Unfortunately probably the most common. A Developer will likely rationalize that this small bug is not important enough to do all the work in option 1.

code of conduct - report abuse