1. Setting up the environment
First you need to check out the correct JBM version from svn repository.
Before running the tests, you need the following tools installed:
Java SDK 1.5 or above.
One of the supported Databases, such as mySQL
Copy the jdbc driver jar file to <svn root>/tests/lib/jdbc-drivers/. The database should have an account for the test. The account name and password should be exactly match those defined in <svn root>/tests/etc/container.xml. If not you need to edit this xml file to use your account name and password. Also make sure the <database> element has the correct DB name of yours. For example if you use mysql, this line should look like
and the 'mysql' should reference to one of the <database-configuration> elements of the same 'name' attribute.
Then go to <svn root>/tests and edit the build.properties, make sure the following properties are added:
For JGroups to work properly in your local machine, you need to run the following command
route add -net 126.96.36.199 netmask 240.0.0.0 dev lo
You need 'root' privilege to run this command.
2. Running the test suite
First you need to build your source. Go to <svn root> and run:
ant jar client-jar
Fix compilation errors if there is any.
Make sure your database is up and running. Then open a terminal window, change to <svn root>/tests/ and run
This will compile the tests and kick off the test suite. Normally it'll take more than 3 hours to finish all tests.
3. Generating the test report
Once the testing finishes, you can generate an html report using the following command
The main page (index.html) is located at <svn root>/tests/output/reports/html. Open it with your browser and you can see all the tests result.
4. Running a single test
JBM provides a script to run a single test or test class. The script is called 'runtest' and is located at <svn root>/tests/bin directory.
This script takes an input file ".testrc" in the same directory, sets up the evn and runs the test defined in the file. The '.testrc' defines a test using two properties, TARGET_CLASS and TARGET_TEST, for example
this means to run the testFailureRightAfterACK test in the org.jboss.test.messaging.jms.clustering.DistributedQueueTest class.
If you don't define TARGET_TEST, it will run all unit tests in the class.
There is a template file '.testrc.example' there. Just copy/rename the file to .testrc and then make proper changes.
Please note there are some other properties defined in the file but normally you don't need to change them, rather you can override them at command line. However you need to make sure the TEST_DATABASE points to your db name (as in etc/container.xml mentioned before).
After you defined your test in .testrc, you are ready to run the runtest script. The syntax is:
where <options> are
-remote : the test needs to launch servers in separate VMs
-clustered : the test needs to launch a jbm cluster. Any clustered tests requires the -remote option to be specified.
-forceipv4 : force the test using IPV4 instead of IPV6. Some test seems not working properly using IPV6. So it's always preferred.
For example, to run the DistributedQueueTest defined above, the command would be
./runtest -remote -clustered -forceipv4
Note: you need the same necessary preparations for running the test suite as for running the single tests.