Menu

#69 Exceptions in junit test code break code instrumentation

open
CORE (51)
5
2006-09-27
2006-09-27
No

A junit test case has code like this near the end of it:

try {
q1.receive(1);
fail("Should have thrown exception");
} catch (IOException e) {
assertEquals("Socket closed", e.getMessage());
}

When I run this test, it succeeds, but most of the
lines before this snippet are marked as not run.

If I comment out this section of code, then the
preceding lines *are* marked as executed. Apparently
something about exceptions is breaking code coverage
instrumentation.

Discussion

  • Vladislav Kaznacheev

    • summary: Excep --> Exceptions
     
  • Vladislav Kaznacheev

    • summary: Exceptions --> Exceptions in junit test code break code instrumentation
     

Log in to post a comment.