DEV Community

Discussion on: What are your biggest problems with unit testing?

Collapse
 
teachingtls profile image
teachingtechleads

Can you define what you mean by "refactoring"? Because the point of unit tests are to prove that your refactoring was completed successfully.
Given that the test passes initially, when you refactor the implementation, then the test should still pass. A refactoring doesn't change the implementation, it just enhances it.

Collapse
 
sandordargo profile image
Sandor Dargo

Most probably he means that the tests are strictly coupled with the production code implementation. Tests are exercising the implementation in a given moment, not the API, the behaviour. Seems like the problem of Test contra-variance.

Collapse
 
thinkdigitalsoftware profile image
ThinkDigitalSoftware

I get what he means. If you change something you believe to be inconsequential, your tests will ensure that. However, if you update a function and change its output and forget to fix a particular function, tests will make your mistakes evident.