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 2 Next »

There are many documents relevant to testing that should be evaluated for veracity, usefulness and relevance:

Junit Testing of Project Wonder in Ant Builds

I have checked in changes to the ant build files. The result of these is:

  1. 1) If you do a build as you used to do a build, there should be no change.
  2. 2) There are two targets at the top-level:
    • test-all - does a clean and then build of frameworks,applications, and examples with -Dinclude.tests=true.
    • test-run - calls a junit test on selected proje
  3. 3) If the "test-all" target is invoked, then, in addition to any test sources being built in the other projects, the Wonder/Tests/ERXTest project is built. Is anyone involved in that project? If not, no harm, no foul.
  4. 4) I added a little stub of a test to ERExtensions. It does nothing right now.
  5. 5) I added a top-level target for "build" in Wonder/build.xml, just because it should be there.

Various things are needed to enable testing in a project:

  1. 1) There must be a "Tests" directory in the top level of the project. So chill has spoken and thus it shall be done. Put junit test java sources under that.
  2. There must be a parameter which defines the main test class. This could be a TestSuite, which would then invoke all the tests in the project. For example, the "ERChronic.all" target in the Build/build/build.xml file now includes the line:
    • <param name="test.className" value="er.chronic.ChronicTestSuite" />

If there is no Tests directory in a project or if there are no sources in the Tests directory, then a build for testing does nothing more than a normal build. If there is no test.className property set in a project's target, then a build for testing does nothing more than a normal build. If there is no test.className property or there are no test classes in the jar files in the build root, then no tests from that project will be run. An example of a "test-run" appears below.

% cd Wonder
% ant
Buildfile: build.xml



    [junit] Testsuite: er.extensions.statistics.ERXMetricsTest
    [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0.002 sec



    [junit] Testsuite: er.chronic.ChronicTestSuite
    [junit] Tests run: 74, Failures: 0, Errors: 0, Time elapsed: 0.355 sec

Total time: 0 seconds

  • No labels