Remix.run Logo
integralid 6 days ago

> So if your code is ascertained to work at the high level, you also know that it must be working at the lower level too

In the ideal world maybe. But It's very hard to test edge cases of a sorting algorithm with integration test. In general my experience is that algorithms and some complex but pure functions are worth writing unit tests for. CRUD app boilerplate is not.

MoreQARespect 6 days ago | parent [-]

Ive never in my life written a test for a sorting algorithm nor, im sure, will i ever need to.

The bias most developers have towards integration tests reflects the fact that even though we're often interviewed on it, it's quite rare that most developers actually have to write complex algorithms.

It's one of the ironies of the profession.

yakshaving_jgt 6 days ago | parent [-]

I write parsers all the time.

Why wouldn’t you test parsers in isolation?

simianwords 6 days ago | parent [-]

Sure but not everyone is working at this level. Dogmatically writing unit tests where they don’t bring much value is something that happens all the time and needs to stop.

No one actually evaluates whether unit tests are needed.

Unit tests at least in my experience, are needed sparingly - in specific places that encompass slightly complicated well contained logic.

yakshaving_jgt 6 days ago | parent [-]

I think parsing happens in more places than people might think.

https://lexi-lambda.github.io/blog/2019/11/05/parse-don-t-va...

simianwords 4 days ago | parent [-]

yeah and if I it pops up I might write a unit test for it. i don't wanna be forced to write it for every damn thing.

yakshaving_jgt 4 days ago | parent [-]

Who is forcing you?

simianwords 3 days ago | parent [-]

people who cargo cult unit tests dogmatically by creating rules like: every class or a public method must have a unit test associated with it.