Question

Does Solr have support for setting up a virtual environment for testing? I'm writing some test cases of a SolrJ client, using an EmbeddedSolrServer.

Right now I'm looking at having my JUnit test case generate a temporary Solr home that can be passed to the CoreContainer used by EmbeddedSolrServer. Is there any easier way?

Était-ce utile?

La solution

Yes, take a look on class - http://lucene.apache.org/solr/4_7_0/solr-test-framework/org/apache/solr/SolrTestCaseJ4.html

All you need is to extend this class, and in test method you could access Solr, send queries, assert response, etc.

Just an example of this kind of test from Solr repo - https://github.com/apache/lucene-solr/blob/c3ef419e4fb720866e88e0020b182de3e25a4fbb/solr/core/src/test/org/apache/solr/search/TestFieldSortValues.java

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top