5.0 Java integration testing

(Gérald Q) #1


Prior to 5.0, I was using NodeClient to start an Embededded Elasticsearch node in my JUnit test cases. With that little trick, I was able to test mappings, searches and so on. I used Spring Testing library to DI in DAO classes.

With 5.0, NodeClient has gone and embedding Elasticsearch (even in test case ?) is forbidden (most classes are not accessible).

I looked at ESIntegTestCase but inheriting from this huge and complicated class just to start an Elasticsearch node worries me. I don't need all the randomized testing stuff. I wonder how it will integrate with other testing frameworks like Spring Testing?

I could start Elasticsearch outside of test cases (Maven, Jenkins...) but it will make test cases development and debugging a lot harder.

What choices do I have?

(David Pilato) #2

I'm using that: http://david.pilato.fr/blog/2016/10/18/elasticsearch-real-integration-tests-updated-for-ga/

(Gérald Q) #3

I already read your article.
But replacing a dozen lines of Java code by hundreds of configuration lines looks cumbersome and is a step backward for me.
Thanks for answering though

(David Pilato) #4

You can also follow the discussion here: https://github.com/alexcojocaru/elasticsearch-maven-plugin/pull/19 and here: https://github.com/elastic/elasticsearch/issues/21119

This might be an answer in the future but I have no date for that though.

(system) #5

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