lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Davids <>
Subject Re: SolrCloud App Unit Testing
Date Sat, 19 Mar 2016 01:57:52 GMT

The Solr codebase generally uses the base “SolrTestCaseJ4” class and sometimes mixes in
the cloud cluster. I personally write a generic abstract base test class to fit my needs and
have an abstract `getSolrServer` method with an EmbeddedSolrServer implementation along with
a separate implementation for the CloudSolrServer. I use the EmbeddedSolrServer for almost
all of my test cases since it is a lot faster to setup, I’ll pull in the Cloud implementation
if there is some distributed logic that is necessary for testing. Here is a simple example
project ( <>)
which has a base test <>
which piggy-backs off the SolrTestCase class. If you don’t want to complete the “exercise”
switch over to the 

Hopefully that points you in the right direction,


> On Mar 17, 2016, at 1:03 PM, Davis, Daniel (NIH/NLM) [C] <>
> MiniSolrCloudCluster is intended for building unit tests for cloud commands within Solr
> What most people do to test applications based on Solr (and their Solr configurations)
is to start solr either on their CI server or in the cloud (more likely the later), and then
point their application at that Solr instance through configuration for the unit tests.  
They may also have separate tests to test the Solr collection/core configuration itself.
> You can have your CI tool (Travis/etc.) or unit test scripts start-up Solr locally, or
in the cloud, using various tools and concoctions.   Part of the core of that is the solr
command-line in SOLR_HOME/bin, post tool in SOLR_HOME/bin, and zkcli in SOLR_HOME/server/scripts/cloud-scripts.
> To start Solr in the cloud, you should look towards something that exists:
> Hope this helps,
> -Dan
> -----Original Message-----
> From: Madhire, Naveen [] 
> Sent: Thursday, March 17, 2016 11:24 AM
> To:
> Subject: FW: SolrCloud App Unit Testing
> Hi,
> I am writing a Solr Application, can anyone please let me know how to Unit test the application?
> I see we have MiniSolrCloudCluster class available in Solr, but I am confused about how
to use that for Unit testing.
> How should I create a embedded server for unit testing?
> Thanks,
> Naveen
> ________________________________________________________
> The information contained in this e-mail is confidential and/or proprietary to Capital
One and/or its affiliates and may only be used solely in performance of work or services for
Capital One. The information transmitted herewith is intended only for use by the individual
or entity to which it is addressed. If the reader of this message is not the intended recipient,
you are hereby notified that any review, retransmission, dissemination, distribution, copying
or other use of, or taking of any action in reliance upon this information is strictly prohibited.
If you have received this communication in error, please contact the sender and delete the
material from your computer.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message