|
|
|
|
|
by hotpocket777
346 days ago
|
|
_in your opinion_ My opinion is, _my unit tests_ are to protect my code against unwanted changes. To that end, unit tests test a single unit. And everything is mocked. If I have to rewrite a method, usually I rewrite all of its unit tests. Which is fine. They’re easy to write or rewrite. Fully mocked unit tests are then supplemented with fewer “full stack” tests higher up the pyramid. |
|
This is just about the most bizarre take on unit testing I've seen in my 25-year career.
> If I have to rewrite a method, usually I rewrite all of its unit tests.
If you have to rewrite your tests every time you rewrite a method, you are entirely defeating the point of testing. What value you get from tests that only assert that the current implementation is equal to the current implementation?