WARNING: Version 1.6 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. If you use maven and its pom.xml
file, it looks like this
<dependencies> <dependency> <groupId>com.carrotsearch.randomizedtesting</groupId> <artifactId>randomizedtesting-runner</artifactId> <version>${randomizedtesting-runner.version}</version> <scope>test</scope> </dependency> <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> <dependency> <groupId>org.elasticsearch</groupId> <artifactId>elasticsearch</artifactId> <version>${elasticsearch.version}</version> <scope>test</scope> </dependency> </dependencies>
Replace the elasticsearch version and the lucene versions with the current elasticsearch version and its accompanying lucene release. And replace the "randomizedtesting version" with the version that the current elasticsearch uses.
There are already have a couple of classes, you can inherit from in your own test classes. The advantages of doing so is having already defined loggers, the whole randomized infrastructure is set up already.