Is there some kind of 'assertion' coverage tool (for Java)? -
before question marked duplicate, please read it. ;) there several questions coverage tools , such, bit different usual ones (i hope).
according wikipedia there several different kind of 'coverage' variations affect several different aspects of term 'coverage'.
here little example:
public class dummy { public int = 0; public int b = 0; public int c = 0; public void dosomething() { += 5; b += 5; c = b + 5; } } public class dummytest { @test public void testdosomething() { dummy dummy = new dummy(); dummy.dosomething(); assertequals( 10, dummy.c ); } }
as can see, test have coverage of 100% lines, assertion on value of field 'c' cover field , indirectly cover field 'b', there no assertion coverage on field 'a'. means test covers 100% of code lines , assures c contains expected value , b contains correct one, not asserted @ , may wrong value.
so... question: there tool able analyze (java) code , create report fields/variables/whatever have not been (directly and/or indirectly) covered assertion?
(ok when using getters instead of public fields see geta() not called, not answer i'd hear ;) )
as can see, test have coverage of 100% lines, assertion on value of field 'c' cover field , indirectly cover field 'b', there no assertion coverage on field 'a'. means test covers 100% of code lines , assures c contains expected value , b contains correct one, not asserted @ , may wrong value.
well, "cover" unfortunately means different things different people... test indeed exercises 100% of code lines, not test them all.
what you're looking handled mutation testing.
have @ jester, uses mutation testing report on code coverage.
Comments
Post a Comment