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
Also see Extreme XP Tools.
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 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 and decoupled from one another. Your unit test suite should run ultra-fast, so that you're encouraged to run it often. 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 acknowledge 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.
How Does This Work
Ashcroft has an implementation of the Java seurity manager. Once registered (See FAQ), it will start monitoring the process. Ashcroft can be configured through additional VM parameter (See Ashcroft Configuration).
You can download the attached jar at this page.
Or you can build it from the Subversion repository: svn://beaver.codehaus.org/ashcroft/scm
Open issues and bugs
Copyright 2004-2005 (C) Obie Fernandez and Aslak Hellesoy. All Rights Reserved.
Redistribution and use of this software and associated documentation
("Software"), with or without modification, are permitted provided
that the following conditions are met:
1. Redistributions of source code must retain copyright
statements and notices. Redistributions must also contain a
copy of this document.
2. Redistributions in binary form must reproduce the
above copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other
materials provided with the distribution.
3. The name "ashcroft" must not be used to endorse or promote
products derived from this Software without prior written
permission of Aslak Hellesoy and Obie Fernandez. For written permission,
please contact aslak.hellesoy@gmail and obiefernandez@gmail.
THIS SOFTWARE IS PROVIDED BY OBIE FERNANDEZ AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
OBIE FERNANDEZ OR HIS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.