# Elasticsearch REST integration test setup

**URL:** <https://discuss.elastic.co/t/elasticsearch-rest-integration-test-setup/147133>\
**Category:** Elasticsearch\
**Created:** [September 4, 2018, 3:13am UTC](https://discuss.elastic.co/t/elasticsearch-rest-integration-test-setup/147133 "2018-09-04T03:13:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jmnarloch](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jmnarloch/32/34854_2.png) [@jmnarloch](https://discuss.elastic.co/u/jmnarloch)\
**Post date:** [September 4, 2018, 3:13am UTC](https://discuss.elastic.co/t/elasticsearch-rest-integration-test-setup/147133/1 "2018-09-04T03:13:22Z")

</div>

I had noticed that in many other questions people are trying to use Elasticsearch test framework to setup integration tests with REST client (either high or low level).

I had manage to configure it without any external dependecies (maven or gradle elasticsearch plugin). This has it prons and cons, but allows to setup a real test case against a cluster and validate the responses.

You can find a working snippet here: [https://gist.github.com/jmnarloch/68ab1ce0535733a65a1b293f7cd99886](https://gist.github.com/jmnarloch/68ab1ce0535733a65a1b293f7cd99886)

Use the class as base for your tests.

You need to add as your project dependencies:  
[https://mvnrepository.com/artifact/org.elasticsearch.test/framework](https://mvnrepository.com/artifact/org.elasticsearch.test/framework)  
[https://mvnrepository.com/artifact/org.elasticsearch.plugin/transport-netty4-client](https://mvnrepository.com/artifact/org.elasticsearch.plugin/transport-netty4-client)

I would be cool though if this would be part of the test framework as well.

---

<div class="post-metadata">

**Author:** ![rjernst](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rjernst/32/6363_2.png) [@rjernst](https://discuss.elastic.co/u/rjernst)\
**Post date:** [September 7, 2018, 9:44pm UTC](https://discuss.elastic.co/t/elasticsearch-rest-integration-test-setup/147133/2 "2018-09-07T21:44:51Z")

</div>

Unfortunately using ESIntegTestCase is not a "real" integration test, due to the fact it is creating an in memory cluster (many nodes in the same jvm). That test case is meant for plugin authors and testing internals of Elasticsearch. We recommend testing client usage with a real cluster, which can be done in either maven or gradle.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [September 8, 2018, 3:36am UTC](https://discuss.elastic.co/t/elasticsearch-rest-integration-test-setup/147133/3 "2018-09-08T03:36:55Z")

</div>

I shared some ideas about integration testing in this thread: [In memory testing with RestHighLevelClient](https://discuss.elastic.co/t/in-memory-testing-with-resthighlevelclient/106196/6)

---

<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:** [October 6, 2018, 3:37am UTC](https://discuss.elastic.co/t/elasticsearch-rest-integration-test-setup/147133/4 "2018-10-06T03:37:05Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
