AspectJ tests

Testing and Tests

Testing on the AspectJ project is fairly straightforward. For compiler issues/bugs, we write harness tests. For API issues/bugs, we write JUnit tests. We also have other testware for system testing.

This module contains test data and scripts, while the testing-drivers and testing modules contain the harness. Tests differ in the kind of harness they use and their target. (Many tests are unused and date back to earlier times in the project.)

Test Description Driver Sources
Harness tests compile and run test sources. Harness in testing-drivers module ajcTests.xml, and ajcTests10.xml, referring to tests in new/, base/, errors/, design/, pureJava/, etc.
Product tests use a variety of Ant and Bash scripts to drive the product distributions. bash, Ant product/..
AjcTest is a large taskdef which compiles and runs large Java systems. AjcTest Ant Task in testing module other-systems/.., aspectj-external-lib.jar?/other-systems/
Jacks is the Jikes compiler test suite, run for us using a bash script. bash See the Jacks project page
JUnit tests normally are run directly before checking in, but there is an Ant script to run and report on them all. JUnit Every module has a testsrc/ directory with JUnit tests.

Harness

Harness tests

These are compiler test cases, the preferred form for any compiler tests. The XML files are test definitions, and the subdirectories contain the test sources (many of which are unused at present). The test definitions are segregated for convenience as follows: The tests specify most anything one could want to do with compile/run variants. The best summary of the test specification format is the ajcTestSuite.dtd.

To write a new test, evolve an existing example. See the dtd and/or the javadoc for the testing harness implementation in the testing module for more details.

To write a test case for a bug, see readme-writing-compiler-tests.html. Many bugs that first present in an IDE or the Ant taskdef are compiler bugs that can be written in this form. We much prefer this automated form over manual steps specified in a bug report.

Running the harness

To run the harness, use org.aspectj.testing.drivers.Harness, in the testing-drivers module. Since that is the main class for the testing-drivers module, you can build and run the harness as follows:

  cd build/
  ../lib/ant/bin/ant build-testing-drivers
  cd ../tests
  java -jar ../aj-build/jars/testing-drivers-all.jar ajcTests.xml
The harness enable you to For a listing of harness options, use -help. For a fuller description of harness options and components, see the package documentation for the harness.

Product

Product tests target a built distribution or do compiler (argument) testing not supported by the harness. Many have been superceded by ant tests. To build aspectj with itself, see product/build-aspectj/build.xml.

AjcTest

ajctest.xml is an Ant script that compiles and runs large systems. The scripts tell the AjcTest task from the testing module to drive the sources in other-systems through compile/doc/run cycles. To set up the tests, the script combines the aspects checked in to other-systems/ with the Java source files from various open-source projects, contained in aspectj-external-lib.zip.

Jacks

Jacks is the Jikes compiler test suite available at the Jacks project page. We have a bash script to run it using ajc and javac and compare the results.

JUnit

The JUnit tests should be self-documenting. For more information on running them, see ../build/readme-build-and-test-aspectj.html.