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?
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.