WARNING: Version 2.3 of Elasticsearch has passed its EOL date.
This documentation is no longer being maintained and may be removed. If you are running this version, we strongly advise you to upgrade. For the latest information, see the current release documentation.
Using the elasticsearch test classes
editUsing the elasticsearch test classes
editFirst, you need to include the testing dependency in your project, along with the elasticsearch dependency you have already added. If you use maven and its pom.xml
file, it looks like this
<dependencies> <dependency> <groupId>org.apache.lucene</groupId> <artifactId>lucene-test-framework</artifactId> <version>${lucene.version}</version> <scope>test</scope> </dependency> <dependency> <groupId>org.elasticsearch</groupId> <artifactId>elasticsearch</artifactId> <version>${elasticsearch.version}</version> <scope>test</scope> <type>test-jar</type> </dependency> </dependencies>
Replace the elasticsearch version and the lucene version with the corresponding elasticsearch version and its accompanying lucene release.
We provide a few classes that you can inherit from in your own test classes which provide:
- pre-defined loggers
- randomized testing infrastructure
- a number of helper methods