Note
This documentation is for the new Bio-Formats 5.1 version. See the latest Bio-Formats 5.0.x version or the previous versions page to find documentation for the version you are using.
At the bottom of many commit messages in https://github.com/openmicroscopy/bioformats, you will find a few lines similar to this:
To test, please run:
ant -Dtestng.directory=$DATA/metamorph test-automated
This shows the command(s) necessary to run automated tests against the files likely to be affected by that commit. If you want to run these tests, you will need to do the following:
Clone bioformats.git and checkout the appropriate branch (by following the directions on the Git usage page). Run this command to build all of the JAR files:
$ ant clean jars
Switch to the test-suite component:
$ cd components/test-suite
Run the tests, where $DATA is the path to the full data repository:
$ ant -Dtestng.directory=$DATA/metamorph test-automated
On Windows, the arguments to the test command must be quoted:
> ant "-Dtestng.directory=$DATA\metamorph" test-automated
By default, 512 MB of memory are allocated to the JVM. You can increase this by adding the ‘-Dtestng.memory=XXXm’ option. You should now see output similar to this:
Buildfile: build.xml
init-title:
[echo] ----------=========== bio-formats-testing-framework ===========----------
init-timestamp:
release-version:
init-manifest-cp:
init:
copy-source:
compile:
test-automated:
[testng] [Parser] Running:
[testng] Bio-Formats software test suite
[testng]
[testng] Scanning for files...
[testng] Building list of tests...
[testng] Ready to test 490 files
[testng] ........................................
and then eventually:
[testng] ===============================================
[testng] Bio-Formats software test suite
[testng] Total tests run: 19110, Failures: 0, Skips: 0
[testng] ===============================================
[testng]
BUILD SUCCESSFUL
Total time: 16 minutes 42 seconds
Each of the dots represents a single passed test; a ‘-‘ is a skipped test, and an ‘F’ is a failed test. This is mostly just for your amusement if you happen to be staring at the console while the tests run, as a more detailed report is logged to bio-formats-software-test-$DATE.log (where “$DATE” is the date on which the tests started in “yyyy-MM-dd_hh-mm-ss” format).
If Ant reports that the build was successful, then there is nothing that you need to do. Otherwise, it is helpful if you can provide the command, branch name, number of failures at the bottom of the Ant output, and the bio-formats-software-test-*.log file.
Tests for the Bio-Formats MATLAB toolbox are written using the xunit framework and are located under components/formats-gpl/test/matlab.
To run these tests, you will need to download or clone matlab-xunit, a xUnit framework with JUnit-compatible XML output. Then add this package together with the Bio-Formats MATLAB to your MATLAB path:
% Add the matlab-xunit toolbox to the MATLAB path
addpath('/path/to/matlab-xunit');
% Add the Bio-Formats MATLAB source to the MATLAB path
% For developers working against the source code
addpath('/path/to/bioformats/components/formats-gpl/matlab');
addpath('/path/to/bioformats/artifacts');
% For developers working against a built artifact, e.g. a release
% addpath('/path/to/bfmatlab');
You can run all the MATLAB tests using runxunit:
cd /path/to/bioformats/components/formats-gpl/test/matlab
runxunit
Individual test classes can be run by passing the name of the class:
cd /path/to/bioformats/components/formats-gpl/test/matlab
runxunit TestBfsave
Individual test methods can be run by passing the name of the class and the name of the method:
cd /path/to/bioformats/components/formats-gpl/test/matlab
runxunit TestBfsave:testLZW
Finally to output the test results under XML format, you can use the -xmlfile option:
cd /path/to/bioformats/components/formats-gpl/test/matlab
runxunit -xmlfile test-output.xml