Full stack developer & undergrad student of Mathematics; very passionate about both. Enthusiastic about learning, teaching, writing, open source, linguistics and more.
A good point! I can personally point to a few tests that I neglected to check, and eventually turned out to be implemented incorrectly 😬
There's also something called Mutation Testing, which, as far as I know, attempts to automate this exact "testing of tests" you're speaking of - it inserts small changes in the source code, and makes sure your tests fail as a result. I've yet to research it properly but it's quite interesting. For JavaScript, there's a mutation testing tool called Stryker Mutator which seems rather popular.
By the way, It's a matter of nuance, but I think I'd phrase the main statement more as a need to "make sure tests fail when they're supposed to", which is exactly their expected behavior (just like you expect a button to do something when you click it!). The statement "any test that has never failed has no value, and therefore, can be deleted" is a bit radical in that sense, as a test could often be implemented properly, and therefore would fail when it needs to - in other words, it has some value.
Thanks @nitzanhen, I'll have to look into mutation testing as I've not come across it before!
As for the statement. Yes it is radical which is why I find it intriguing!
Even though it could be implemented correctly and could fail, if it never has then what value has it added? The only way to prove the value is by it failing.
Full stack developer & undergrad student of Mathematics; very passionate about both. Enthusiastic about learning, teaching, writing, open source, linguistics and more.
A good point! I can personally point to a few tests that I neglected to check, and eventually turned out to be implemented incorrectly 😬
There's also something called Mutation Testing, which, as far as I know, attempts to automate this exact "testing of tests" you're speaking of - it inserts small changes in the source code, and makes sure your tests fail as a result. I've yet to research it properly but it's quite interesting. For JavaScript, there's a mutation testing tool called Stryker Mutator which seems rather popular.
By the way, It's a matter of nuance, but I think I'd phrase the main statement more as a need to "make sure tests fail when they're supposed to", which is exactly their expected behavior (just like you expect a button to do something when you click it!). The statement "any test that has never failed has no value, and therefore, can be deleted" is a bit radical in that sense, as a test could often be implemented properly, and therefore would fail when it needs to - in other words, it has some value.
Cheers!
Thanks @nitzanhen, I'll have to look into mutation testing as I've not come across it before!
As for the statement. Yes it is radical which is why I find it intriguing!
Even though it could be implemented correctly and could fail, if it never has then what value has it added? The only way to prove the value is by it failing.
I get what you mean. Intriguing indeed!