# ElasticearchIntegrationTest and Spring

**URL:** <https://discuss.elastic.co/t/elasticearchintegrationtest-and-spring/16294>\
**Category:** Elasticsearch\
**Created:** [March 11, 2014, 3:20pm UTC](https://discuss.elastic.co/t/elasticearchintegrationtest-and-spring/16294 "2014-03-11T15:20:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yoav\_Felberbaum](https://avatars.discourse-cdn.com/v4/letter/y/eb8c5e/32.png) [@Yoav\_Felberbaum](https://discuss.elastic.co/u/Yoav_Felberbaum)\
**Post date:** [March 11, 2014, 3:20pm UTC](https://discuss.elastic.co/t/elasticearchintegrationtest-and-spring/16294/1 "2014-03-11T15:20:36Z")

</div>

Hello,

I am trying to integrate the ElasticearchIntegrationTest class in my  
integration tests. However, for one particular test, we would like to use  
the Spring framework, more specifically the SpringJUnit4Runner (in order to  
inject the spring context).

However, it seems that they do not play with each other nicely due to the  
dependency by ElasticearchIntegrationTest on RandomizedRunner to set up its  
own context.

Does anyone have any suggestions on how we can do integration testing using  
Spring?

Thanks for any ideas!

Y.

--  
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/1d2e5be2-b60b-4f77-b97e-a8a32a826929%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/1d2e5be2-b60b-4f77-b97e-a8a32a826929%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [March 12, 2014, 10:13am UTC](https://discuss.elastic.co/t/elasticearchintegrationtest-and-spring/16294/2 "2014-03-12T10:13:01Z")

</div>

Hey,

you are correct, the two runners would clash. Maybe you could use  
the TestCluster class directly to start and stop instances in that  
particular test? However you would lose all the nice randomized features...  
but maybe thats ok in that case?

--Alex

On Tue, Mar 11, 2014 at 4:20 PM, Yoav Felberbaum [realmrdini@gmail.com](mailto:realmrdini@gmail.com)wrote:

> Hello,
> 
> I am trying to integrate the ElasticearchIntegrationTest class in my  
> integration tests. However, for one particular test, we would like to use  
> the Spring framework, more specifically the SpringJUnit4Runner (in order to  
> inject the spring context).
> 
> However, it seems that they do not play with each other nicely due to the  
> dependency by ElasticearchIntegrationTest on RandomizedRunner to set up its  
> own context.
> 
> Does anyone have any suggestions on how we can do integration testing  
> using Spring?
> 
> Thanks for any ideas!
> 
> Y.
> 
> --  
> 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/1d2e5be2-b60b-4f77-b97e-a8a32a826929%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/1d2e5be2-b60b-4f77-b97e-a8a32a826929%40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/1d2e5be2-b60b-4f77-b97e-a8a32a826929%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/1d2e5be2-b60b-4f77-b97e-a8a32a826929%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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/CAGCwEM8cZRTr1fLrLwP6kRUV8Mad2xOigB-EnNb2UW7AUgj4Dw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGCwEM8cZRTr1fLrLwP6kRUV8Mad2xOigB-EnNb2UW7AUgj4Dw%40mail.gmail.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, 1:43am UTC](https://discuss.elastic.co/t/elasticearchintegrationtest-and-spring/16294/3 "2017-07-06T01:43:53Z")

</div>


