Remix.run Logo
MoreQARespect 6 days ago

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.