News for hackers. Stuff that matters.
Re:Unit Tests Considered Harmful by taylodl on Friday April 12, 2024 @09:28AM (#40012530)
Depends on how your unit tests were designed. You need to avoid the Fragile Test Problem. Bob Martin wrote about this a while back: http://blog.cleancoder.com/uncle-bob/2017/10/03/TestContrava...
Re:Unit Tests Considered Harmful by rTX5CMRXIfFG on Friday April 12, 2024 @09:30AM (#40012572)
There needs to be a rule against having to read entire articles or YT videos just so that a reader can understand the point that a commenter is trying to make, but which they cannot explain in their own words, no? It’s very anti-discussion, and how do we even know to what extent commenters are quoting or agreeing with their sources?
Re:Unit Tests Considered Harmful by taylodl on Friday April 12, 2024 @10:09AM (#40013104)
Your unit tests should be contravariant to the code its testing so that way your code can be refactored and your existing unit tests can be used AS-IS to test the refactored code.

The Fragile Test Problem arises when your unit tests are covariant to the code its testing, such that a significant refactor breaks the tests - not because the code is necessarily wrong, but the structure of the code is no longer what the unit test was expecting.

Re:Unit Tests Considered Harmful by bluGill on Friday April 12, 2024 @09:57AM (#40012961)
While the link in question isn't a good article, for complex subjects like this a long article is much better. The article linked should take several days to create if you are a great writer (again, I would create in a different way, but the content deserves days or even weeks of work to create), and thus cannot fit in a comment box except in a reduced form that doesn't do the idea justice.