Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 27 Next »

When you are coding, how often do you run your unit test suite? Once a day? Once an hour? Once a minute? Could you even run the suite once a minute if you wanted to? Project Background


Regardless of your political beliefs, as an agile and test-infected Java developer, we'd like you to consider the benefits of adhering to strict, some might say "dictatorial", limits on the way that you write your unit tests.

We should clarify, right up front, that these restrictions apply only to unit tests and not system tests or integration tests, which are also of great importance to the success of any project. However, your unit tests, at least one for each class in your codebase, should be clean, decoupled from one another, and run ultra-fast. We think you should be able to run thousands of unit tests and get your green bar in a few seconds. Achieving that kind of performance takes major discipline on the part of the developer, and Ashcroft helps you learn that discipline by failing tests which stray from best practices.

Remember, the most severe restrictions often lead to the most creative solutions.

Ten Commandments of Unit Tests

  1. I am the class being tested. Thou shalt not test any other class but me.
  2. Thou shalt write isolated tests
  3. Thou shalt not access files during unit tests
  4. Thou shalt not write two tests which depend upon each other

There are more of these to come... we are currently soliciting feedback.


Technical FAQ

Design FAQ

Java Security Manager


Only in Subversion for now: svn://

You can also try the attached jar at the bottom of this page...

Open issues and bugs

com.atlassian.confluence.macro.MacroExecutionException: JIRA project does not exist or you do not have permission to view it.
  • No labels