Building and running tests
You will need ant build system. customBuild.xml
supports different parameters to tune the tests. They can also be combined.
customBuild.xml common commands
- compile: recompiles the production code for project. Required if you changed any code in src folder.
- compile-test: recompiles the test code for the project. Required if you updated any code test folder.
- test-set: by using the parameter
-Dtest.testcases="tlc2/tool/InliningTest*"
we can specify a single test to run. It also supports regexes.
Example:
ant -f customBuild.xml compile compile-test test-set -Dtest.testcases="tlc2/tool/Github1109Test.java"
Running a test with a debugger
-Dtest.suspend=y
will suspend the execution and give you time to hook up a debugger before running a test.
ant -f customBuild.xml compile-test test-set -Dtest.suspend=y -Dtest.testcases="tlc2/tool/InliningTest*"
Specify number of threads
By default uses all your cores. You can specify a custom amount using -Dthreads=4
:
ant -f customBuild.xml test -Dthreads=4
Halt tests when a failure is found
By default the test target will run all the test and report success or failure only at the end. It can be convinient to just stop execution as soon as an error is found, with-Dtest.halt=true
.
ant -f customBuild.xml test -Dtest.halt=true
test-dist:
Executes accompanying unit tests on jar file
ant -f customBuild.xml clean compile compile-test test-dist