WARNING: Version 6.0 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.test</groupId> <artifactId>framework</artifactId> <version>${elasticsearch.version}</version> <scope>test</scope> </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