News for hackers. Stuff that matters.
Re:Questions to ask yourself when writing tests by V2hLe0ThslzRaV2 on Monday January 01, 2018 @07:47PM (#16048990)
>> "For every part of my code change, if I break the code, will a test fail?"

Since "breaking code" is super subjective, and generally speaking, trying to "cover everything" is a recipe for hell.

Anyone able to expand on what the author meant by this?

Re:Questions to ask yourself when writing tests by michalc on Tuesday January 02, 2018 @10:05AM (#16052198)
Perhaps this part is not clear / well defined, but roughly, I meant that code coverage is (about) 100% for the lines added/changed, and some "reasonable" subset of possible breaking changes would be picked up by failing tests.

What I had in mind specifically in the answer, was the case of changing "interfaces" between parts of code. For example, the case of changing a function's arguments, or how it uses them, but omitting to change a call site. Checking that the call site just calls the function would not be enough to produce a failing test, especially without type safety. The test would actually need to assert on what the function does, e.g. its return value for a pure function.

Yes, I think trying to test against every single possible breaking change is not valuable.

Re:Questions to ask yourself when writing tests by jcrben on Monday January 01, 2018 @08:30PM (#16049166)
Meaning: if I break the feature, will I know about it from a test failure?

Basically, you put the customer first. Make sure your features are tested such that they can't fail without a failing test before writing lower-level tests.

This is also the approach advocated by the popular book Growing Object-Oriented Software Guided by Tests.

Re:Questions to ask yourself when writing tests by atticusCr on Monday January 01, 2018 @10:17PM (#16049595)
That's actually, IMHO, a good asset that comes out of a good test and code coverage. I would be worried if after adding new piece of code or modifying an existing code if there is not a test that tells me that something is broken due my code.

Here is where testing becomes very helpful.

Re:Questions to ask yourself when writing tests by brucephillips on Monday January 01, 2018 @07:48PM (#16048991)
> since breaking code is super subjective.

Only to the extent that your spec is incomplete.