This Confluence has been LDAP enabled, if you are an ASF Committer, please use your LDAP Credentials to login. Any problems file an INFRA jira ticket please.

Page tree
Skip to end of metadata
Go to start of metadata

Running Tests

This page describes how to run Lucene/Solr tests and various options you can use.

Using Ant

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.

Basic Operations

Running all tests

To run all tests, just run ant test.

You can run tests at the project, product, module, or sub-module level:

  • At the top-level (containing lucene/ and solr/), all Lucene and Solr tests will be run.
  • Under lucene/, all Lucene tests will be run.
  • Under lucene/core/, only Lucene core tests will be run.
  • etc.

Running only a specific test class

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"

Running only a specific test method

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.

Running all tests in a specific package

To run tests in a specific package, use -Dtests.class

For example: ant test -Dtests.class="*.search.*"

Test Options

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.



default value



increases verbosity of tests. Use this to get (potentially very loud) test output




separately toggle infostream output from indexwriter and checkindex




sets the FlexibleIndexing codec for the test to use




sets the specific PostingsFormat to use for Lucene40 codec




sets the JVM default locale for a test to run under




sets the JVM default timezone for a test to run under



sets the lucene directory impl for a test to use



multiplier to increase the work done by random tests




show stdout/err even when test is successful



  • No labels