in reply to Testing my tests (mutation testing)
If I'm understanding correctly, you're wanting something that can introspect the tests themselves, and make sure that you're asserting on the actual return value of a sub or not. Correct?
I think that may be pretty involved to do, as after some quick thought, you'd need to introspect the test file itself, map a test with the sub in question, and validate whether *all* return paths are asserted against:
# module sub perform { my ($x, $y) = @_; if ($x < 10){ return $x + $y; } if ($x == 10){ return $x * $y; } return $x - $y; }
Then:
is perform(5, 5), 10, "..."; is perform(10, 5), 50, "..."; is perform(20, 5), 15, "...";
So it would almost seem as though you'd need to actually write tests against your tests. If there is an existing solution for these types of things, I'd definitely be interested in knowing about it as well.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Testing my tests
by choroba (Cardinal) on Feb 26, 2017 at 16:09 UTC | |
by stevieb (Canon) on Feb 26, 2017 at 16:14 UTC | |
by Anonymous Monk on Feb 27, 2017 at 23:57 UTC | |
|
Re^2: Testing my tests
by BrowserUk (Patriarch) on Feb 26, 2017 at 18:42 UTC | |
by GrandFather (Saint) on Feb 26, 2017 at 20:02 UTC | |
by stevieb (Canon) on Feb 26, 2017 at 21:06 UTC | |
|
Re^2: Testing my tests
by szabgab (Priest) on Feb 26, 2017 at 16:17 UTC | |
by stevieb (Canon) on Feb 26, 2017 at 16:33 UTC |