# Integration tests with gradle

**URL:** <https://discuss.elastic.co/t/integration-tests-with-gradle/21340>\
**Category:** Elasticsearch\
**Created:** [December 20, 2014, 9:24pm UTC](https://discuss.elastic.co/t/integration-tests-with-gradle/21340 "2014-12-20T21:24:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jkschneider](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jkschneider/32/1041_2.png) [@jkschneider](https://discuss.elastic.co/u/jkschneider)\
**Post date:** [December 20, 2014, 9:24pm UTC](https://discuss.elastic.co/t/integration-tests-with-gradle/21340/1 "2014-12-20T21:24:35Z")

</div>

The docs  
[http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/using-elasticsearch-test-classes.html](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/using-elasticsearch-test-classes.html) for  
unit testing have you configuring your pom in a certain way. Apparently  
the order of these dependencies matter.

When attempting to use the ElasticsearchIntegrationTest class from a  
project managed by gradle, the dependencies section would look something  
like this:

dependencies {  
testCompile 'org.hamcrest:hamcrest-core:1.3'  
testCompile 'junit:junit:4.12'

```
testCompile 'org.elasticsearch:elasticsearch:1.3.4:tests'
testCompile 'org.apache.lucene:lucene-test-framework:4.9.1'
testCompile 'com.carrotsearch.randomizedtesting:randomizedtesting-runner:2.1.11'

compile 'org.elasticsearch:elasticsearch:1.3.4'

```

}

Unfortunately, classpath order is not guaranteed in this world, and so a simple test with ElasticsearchIntegrationTest fails with:

java.lang.AssertionError: fix your classpath to have tests-framework.jar before lucene-core.jar  
\_\_randomizedtesting.SeedInfo.seed([20D50B2CB59AFD95]:0)  
org.apache.lucene.util.TestRuleSetupAndRestoreClassEnv.before(TestRuleSetupAndRestoreClassEnv.java:177)  
org.apache.lucene.util.AbstractBeforeAfterRule$1.evaluate(AbstractBeforeAfterRule.java:45)  
org.apache.lucene.util.TestRuleStoreClassName$1.evaluate(TestRuleStoreClassName.java:42)  
[...com.carrotsearch.randomizedtesting._]  
org.apache.lucene.util.TestRuleAssertionsRequired$1.evaluate(TestRuleAssertionsRequired.java:43)  
org.apache.lucene.util.TestRuleMarkFailure$1.evaluate(TestRuleMarkFailure.java:48)  
org.apache.lucene.util.TestRuleIgnoreAfterMaxFailures$1.evaluate(TestRuleIgnoreAfterMaxFailures.java:65)  
org.apache.lucene.util.TestRuleIgnoreTestSuites$1.evaluate(TestRuleIgnoreTestSuites.java:55)  
[...com.carrotsearch.randomizedtesting._]  
java.lang.Thread.run(Thread.java:745)

Do we have a documented story for how to test elasticsearch code with Gradle?

Jon

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/57716599-1b93-4c7a-b254-bc1789703453%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/57716599-1b93-4c7a-b254-bc1789703453%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 12:42am UTC](https://discuss.elastic.co/t/integration-tests-with-gradle/21340/2 "2017-07-06T00:42:31Z")

</div>


