RSS Feed for This PostCurrent Article

Java: JUnit Max

JUnit Max is an Eclipse plug-in that helps programmers stay focused on coding by running tests intelligently and reporting results unobtrusively. Every time you save a Java file, Max runs your tests and reports errors in the same format as compile errors. In addition, Max runs the tests most likely to fail first, so you only have to pay close attention to test results for a second (literally) before getting back to coding, even if you have a long-running test suite.

Max’s optimizing runner works because of two convenient facts:

  • Test runtimes generally follow a power law distribution–lots of very short tests and a few very long ones. This means that by running the short tests first you can get most of the feedback in a fraction of the runtime of the whole suite (assuming test failures aren’t correlated with test run length, which I haven’t verified yet).
  • Test failures are not randomly distributed. A test that failed recently is more likely to fail than one that has run correctly a bazillion times in a row. By putting recently failed (and newly written) tests first in the queue, you maximize the information density of that critical first second of feedback (before you get distracted and go check Twitter).

Trackback URL

Sorry, comments for this entry are closed at this time.