ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul Dillon" <>
Subject RE: JUnit example/readings
Date Tue, 26 Jun 2001 01:52:31 GMT
> Java Server Programming by Wrox has a chapeter on it.

Just a warning if you intend to buy online: I have the 1st edition of
this book which does not have anything on JUnit.

The documentation wasn't immediately clear to me either.  Easiest way to
get started is to:
1. create a class that extends TestCase
2. provide the constructor that takes a name string and calls
3. for each test, provide a method with a name starting with "test".
4. use the assert methods to check for expected behaviour.


public class SimpleTest extends junit.framework.TestCase {
    public SimpleTest(String name) {
    public void testAdd() {
        int sum = 1 + 1;
        assertEquals(2, sum);

Next step would be to override the setUp and tearDown methods.
Documentation is OK on this.

- Paul

View raw message