News for hackers. Stuff that matters.
Re:Is TDD Dead? (2014) by bmh100 on Wednesday August 26, 2020 @11:10AM (#24283143)
"External" functionality will be behavior visible to other code units or to users. If you have a sorting function, the sorted list is external. The sorting algorithm is internal. Regression tests are often used in the context of enhancements and refactorings. You want to test that the rest of the program still behaves correctly. Knowing what behavior to test is specific to the domain and to the technologies used. You can ask yourself, "how do I know that this thing actually works?"
Re:Is TDD Dead? (2014) by fiddlerwoaroof on Wednesday August 26, 2020 @11:44AM (#24283492)
Isn’t the point that internal functions often have a much smaller state space than external functions, so it’s often easier to be sure that the edge cases of the internal functions are covered than that the edge cases of the external function are covered?

So, having detailed tests of internal functions will generally improve the chances that your test will catch a regression.

Re:Is TDD Dead? (2014) by marcosdumay on Wednesday August 26, 2020 @12:26PM (#24284017)
> Isn’t the point that internal functions often have a much smaller state space than external functions

That's the general theory, and why people recommend unit tests instead of only the broader possible integration tests. But things are not that simple.

Interfaces do not only add data, they add constraints too. And constraints reduce your state space. You will want to cut your software over the smallest possible interface complexity you can find and test those, those pieces are what people originally called "unities". You don't want to test any high-complexity interface, those tests will harm development and almost never give you any useful information.

It's not even rare that your unities are composed of vertical cuts through your software, so you'll end up with only integration tests.

The good news is that this kind of partition is also optimal for understanding and writing code, so people have been practicing it for ages.

Re:Is TDD Dead? (2014) by bmh100 on Wednesday August 26, 2020 @01:13PM (#24284581)
I agree that they would help in the regression testing process, especially in diagnosing the cause. However, I think those are usually just called "unit" tests, not "regression" tests. For instance, the internal implementation of a feature might change, requiring a new, internal unit test. The regression test would be used to compare the output of the new implementation of the feature versus the old implementation of the feature.
Re:Is TDD Dead? (2014) by ska on Wednesday August 26, 2020 @12:09PM (#24283808)
Having regression tests greatly improves your chances of catching a regression.
Re:Is TDD Dead? (2014) by amalcon on Wednesday August 26, 2020 @03:56PM (#24286565)
Worth noting that performance is an externally visible feature. You shouldn't be testing for little performance variations, but you probably should check for pathological cases (e.g. takes a full minute to sort this particular list of only 1000 elements).
Re:Is TDD Dead? (2014) by the_af on Wednesday August 26, 2020 @02:13PM (#24285407)
> "how do I know that this thing actually works?"

Agreed, but how do you know your test tests this? Or to re-phrase it: why would you even write a test that doesn't test this?