SE450: JUnit: Integrating with Ant [40/41] Previous pageContentsNext page

.jar files - put junit.jar in both your own lib directory, and %ANT_HOME%\lib.

build.xml changes - pay attention to the compiletests, test, and alltests tasks.

A test result file looks like this:

TEST-se450.mwright1.junit.VectorTest.txt


Testsuite: se450.mwright1.junit.VectorTest
Tests run: 3, Failures: 0, Errors: 0, Time elapsed: 0.02 sec

Testcase: testCapacity took 0.01 sec
Testcase: testContains took 0 sec
Testcase: testElementAt took 0 sec

compiling tests - run the compiletests task in Ant, or use javac like before but with the junit.jar file in your classpath.

run tests using either:

  1. junit.textui.TestRunner
  2. junit.awtui.TestRunner
  3. junit.swingui.TestRunner
  4. ant test - set the test name in ant.properties
  5. ant alltests

Both of the ant tasks use a version of junit.textui.TestRunner

Previous pageContentsNext page