▲ 1410 ▼ Tests are code too (lemmy.world) submitted 2 years ago by jroid8@lemmy.world to c/programmerhumor@lemmy.ml 79 comments fedilink hide all child comments
[–] AAA@feddit.de 96 points 2 years ago (5 children) Who tests the tests permalink fedilink source hideshow 10 child comments replies: [–] BustlingChungus@lemmy.world 47 points 2 years ago The Testmen? permalink fedilink source parent [–] dan@upvote.au 13 points 2 years ago (1 child) I've written some tests that got complex enough that I also wrote tests for the logic within the tests. permalink fedilink source parent hideshow 2 child comments replies: [–] AAA@feddit.de 7 points 2 years ago We do that for some of the more complex business logic. We wrote libraries, which are used by our tests, and we wrote tests which test the library functions to ensure they provide correct results. What always worries me is that WE came up with that. It wasn't some higher up, or business unit, or anything. Only because we cared to do our job correctly. If we didn't - nobody would. Nobody is watching the testers (in my experience). permalink fedilink source parent [–] kevincox@lemmy.ml 6 points 2 years ago (1 child) Mutation testing is quite cool. Basically it analyzes you code and makes changes that should break something. For example if you have if (foo) { ... } it will remove the branch or make the branch run every time. It then runs your tests and sees if anything fails. If the tests don't fail then either you should add another test, or that code was truly dead and should be removed. Of course this has lots of "false positives". For example you may be checking if an allocation succeeded and don't need to test if every possible allocation in your code fails, you trust that you can write if (!mem) abort() correctly. permalink fedilink source parent hideshow 2 child comments replies: [–] Lifter@discuss.tchncs.de 1 point 2 years ago Right,too much coverage is also a bad thing. It leads to having to work on the silly tests every time you change som implementation detail. Good tests let the insides of the unit change without breaking, as long as the behave the same to the outside world. permalink fedilink source parent [–] Kidplayer_666@lemm.ee 5 points 2 years ago Create tests to test the tests. Create tests to test those. Recurse to infinity permalink fedilink source parent [–] dopeshark@lemmy.world 3 points 2 years ago (1 child) Who tests the tests for the tests permalink fedilink source parent hideshow 2 child comments replies: [–] AAA@feddit.de 3 points 2 years ago Unfortunately, if anyone, I do. permalink fedilink source parent
[–] dan@upvote.au 13 points 2 years ago (1 child) I've written some tests that got complex enough that I also wrote tests for the logic within the tests. permalink fedilink source parent hideshow 2 child comments replies: [–] AAA@feddit.de 7 points 2 years ago We do that for some of the more complex business logic. We wrote libraries, which are used by our tests, and we wrote tests which test the library functions to ensure they provide correct results. What always worries me is that WE came up with that. It wasn't some higher up, or business unit, or anything. Only because we cared to do our job correctly. If we didn't - nobody would. Nobody is watching the testers (in my experience). permalink fedilink source parent
[–] AAA@feddit.de 7 points 2 years ago We do that for some of the more complex business logic. We wrote libraries, which are used by our tests, and we wrote tests which test the library functions to ensure they provide correct results. What always worries me is that WE came up with that. It wasn't some higher up, or business unit, or anything. Only because we cared to do our job correctly. If we didn't - nobody would. Nobody is watching the testers (in my experience). permalink fedilink source parent
[–] kevincox@lemmy.ml 6 points 2 years ago (1 child) Mutation testing is quite cool. Basically it analyzes you code and makes changes that should break something. For example if you have if (foo) { ... } it will remove the branch or make the branch run every time. It then runs your tests and sees if anything fails. If the tests don't fail then either you should add another test, or that code was truly dead and should be removed. Of course this has lots of "false positives". For example you may be checking if an allocation succeeded and don't need to test if every possible allocation in your code fails, you trust that you can write if (!mem) abort() correctly. permalink fedilink source parent hideshow 2 child comments replies: [–] Lifter@discuss.tchncs.de 1 point 2 years ago Right,too much coverage is also a bad thing. It leads to having to work on the silly tests every time you change som implementation detail. Good tests let the insides of the unit change without breaking, as long as the behave the same to the outside world. permalink fedilink source parent
[–] Lifter@discuss.tchncs.de 1 point 2 years ago Right,too much coverage is also a bad thing. It leads to having to work on the silly tests every time you change som implementation detail. Good tests let the insides of the unit change without breaking, as long as the behave the same to the outside world. permalink fedilink source parent
[–] Kidplayer_666@lemm.ee 5 points 2 years ago Create tests to test the tests. Create tests to test those. Recurse to infinity permalink fedilink source parent
[–] dopeshark@lemmy.world 3 points 2 years ago (1 child) Who tests the tests for the tests permalink fedilink source parent hideshow 2 child comments replies: [–] AAA@feddit.de 3 points 2 years ago Unfortunately, if anyone, I do. permalink fedilink source parent
[–] AAA@feddit.de 3 points 2 years ago Unfortunately, if anyone, I do. permalink fedilink source parent