
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
Introduction
Regardless of your political beliefs, as an agile and test-infected 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 as well as the code being tested (SUT).
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
- I am the class being tested. Thou shalt not test any other class but me.
- Thou shalt write isolated tests
- Thou shalt not access files during unit tests
- Thou shalt not write two tests which depend upon each other
There are more of these to come... we are currently soliciting feedback.
FAQ
Technical FAQ
- How do I use Ashcroft with Ant
- How do I use Ashcroft with Maven
- How do I use Ashcroft with IntelliJ IDEA
- How do I use Ashcroft with Eclipse
- What is Ashcroft's peformance impact
Design FAQ
Java Security Manager
- http://www.javaworld.com/javaworld/jw-11-1997/jw-11-hood.html
- http://java.sun.com/docs/books/tutorial/security1.2/
Download
Only in Subversion for now: svn://beaver.codehaus.org/ashcroft/scm
You can also try the attached jar at the bottom of this page...
