Differences between revisions 10 and 11
Revision 10 as of 2012-04-16 20:47:08
Size: 3221
Editor: SteveRowe
Comment: add RandomizedTesting library link to avoid WikiLinkificationOhNooooooo
Revision 11 as of 2012-06-02 14:37:11
Size: 3333
Comment: add -Dtests.showSuccess
Deletions are marked like this. Additions are marked like this.
Line 65: Line 65:
||tests.showSuccess ||show stdout/err even when test is successful ||false ||{{{-Dtests.showSuccess=true}}} ||

Running Tests

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

Using Ant

Running the tests requires Apache Ant version 1.7.0 or 1.7.1.

Note: do not use higher versions (e.g. 1.8.1)

Tests run using the RandomizedTesting library. For usage instructions, run ant test-help.

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.

variable

description

default value

example

tests.verbose

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

false

-Dtests.verbose=true

tests.infostream

separately toggle infostream output from indexwriter and checkindex

tests.verbose

-Dtests.infostream=true

tests.codec

sets the FlexibleIndexing codec for the test to use

random

-Dtests.codec=SimpleText

tests.postingsformat

sets the specific PostingsFormat to use for Lucene40 codec

random

-Dtests.postingsformat=Pulsing

tests.locale

sets the JVM default locale for a test to run under

random

-Dtests.locale=ru_RU

tests.timezone

sets the JVM default timezone for a test to run under

random

-Dtests.timezone=Australia/Lindeman

tests.directory

sets the lucene directory impl for a test to use

random

-Dtests.directory=FSDirectory

tests.multiplier

multiplier to increase the work done by random tests

1

-Dtests.multiplier=3

tests.showSuccess

show stdout/err even when test is successful

false

-Dtests.showSuccess=true

RunningTests (last edited 2012-06-02 14:37:11 by MikeMcCandless)