Real Time Web Analytics

Welcome to JUnit Max

I have way too much say to fit into any one post, so I’ll try to stick to the essential now and expand later. Here’s what’s essential: using JUnit is an expression of taking responsibility for the quality of your work. My intention is that JUnit Max supports you further in that responsibility.

I could imagine lots of tools to make developer testing better but I had to start somewhere. I started with the moment after you press “run”, while you’re waiting for test results. I find this moment tremendously distracting. My “efficiency” urge tells me I ought to check email, Twitter, write a message, something, not just wait for the tests to finish. If I want to be an effective programmer, though, I need to resist this urge. Staying focused on my task is what helps me make further progress. I wanted a tool to help me stay focused.

The first part of the solution is to get smarter about running tests so the average wait to the first test failure is shorter. Tests don’t fail at random. New tests and tests that have failed recently are more likely to fail than other tests, so Max runs them first. Also, test run-times follow a power law distribution (more about this in later posts), so by running short tests first, Max provides more feedback in those critical first few seconds.

I implemented this first, but I found the Eclipse test runner UI distracting. I was just writing a test, I should see the results right in context. The second feature of this first release of JUnit max is to treat test failures like compiler errors. When you save a file in a project, Max runs all the tests in the project. If a test fails, it appears as a marker:

JUnit Max screen shot

What I notice while coding with JUnit Max is that my attention stays on the code. I make a change, save the file, take a quick glance to make sure the high-risk tests passed, and get back to coding while the rest of the tests run.

My ambition is to bring the benefits of JUnit Max to many languages and environments, but once I again I had to start somewhere so I started with Eclipse and Java. Max is currently beta quality–I’m quite sure it will work with simple projects but I’m certain it will not work with all the complexity possible in Eclipse projects. I can promise you that I will respond as quickly as I can if Max doesn’t work for you and your project.

As I said at the beginning, I have big plans for Max (it’s got quite a name to live up to). Testing is such a new part of the programmer’s daily, hourly activity that technique and tools are evolving rapidly. I’ll be adding new features to the Max test runner, adding user interfaces to extract novel information from tests, and making testing activity a way of connecting with other programmers.

JUnit Max is two dollars a month (I’ll explain my reasoning about this in a later post, when I talk about programming for a living). Subscribe to JUnit Max. If you have questions or comments, you can find me by email or on Twitter.

–Kent Beck

Leave a comment

Your comment