This page describes how to run Lucene/Solr tests and various options you can use.
Running the tests on trunk and branch_4x requires Ant version 1.8.2 or higher. The 3.x releases would only work with Ant version 1.7 and would not work with 1.8 or later.
Tests run using the RandomizedTesting library.
For full usage instructions, run ant test-help
. A subset of those instructions follows here.
To run all tests, just run ant test
.
You can run tests at the project, product, module, or sub-module level:
lucene/
and solr/
), all Lucene and Solr tests will be run.lucene/
, all Lucene tests will be run.lucene/core/
, only Lucene core tests will be run.To run a specific test class, use -Dtests.class
tests.class
filters full class names (including package) using a shell-like glob pattern.
For example, to run only TestIndexWriter
: ant test -Dtests.class="*.TestIndexWriter"
(The quotations around the glob pattern prevent shell expansion.)
-Dtestcase=Xyz
is an alias of -Dtests.class="*.Xyz"
To run just a single method in a test, use -Dtests.method
tests.method
filters method names using a shell-like glob pattern.
For example: ant test -Dtests.class="*.TestIndexWriter" -Dtests.method="test*Count"
testmethod
is an alias of tests.method
.
To run tests in a specific package, use -Dtests.class
For example: ant test -Dtests.class="*.search.*"
The following Lucene/Solr-specific options (not handled by the RandomizedTesting library) can be used to modify the behavior of tests.
From ant, you can set these on the command line by using -D
.
From your IDE, you can set these by adding jvm arguments with -D
.
variable |
description |
default value |
example |
tests.verbose |
increases verbosity of tests. Use this to get (potentially very loud) test output |
false |
|
tests.infostream |
separately toggle infostream output from indexwriter and checkindex |
tests.verbose |
|
tests.codec |
sets the FlexibleIndexing codec for the test to use |
random |
|
tests.postingsformat |
sets the specific PostingsFormat to use for Lucene40 codec |
random |
|
tests.locale |
sets the JVM default locale for a test to run under |
random |
|
tests.timezone |
sets the JVM default timezone for a test to run under |
random |
|
tests.directory |
sets the lucene directory impl for a test to use |
random |
|
tests.multiplier |
multiplier to increase the work done by random tests |
1 |
|
tests.showSuccess |
show stdout/err even when test is successful |
false |
|