diff --git a/tests/solr_index_and_search.test b/tests/solr_index_and_search.test
index a41bd8f..a4b5868 100755
--- a/tests/solr_index_and_search.test
+++ b/tests/solr_index_and_search.test
@@ -1,12 +1,24 @@
 <?php
 
-class DrupalSolrOnlineWebTestCase extends DrupalWebTestCase {
+abstract class AbstractDrupalSolrOnlineWebTestCase extends DrupalWebTestCase {
+
+  protected $solr;
+
   /**
    * Implementation of setUp().
    */
   function setUp() {
+    $args = func_get_args();
+    $args[] = 'apachesolr';
+    $args[] = 'apachesolr_search';
+    $args[] = 'search';
+
+    call_user_func_array('parent::setUp', $args);
+  }
+
+  function setUpSolr() {
+    $patterns = func_get_args();
 
-    parent::setUp('apachesolr', 'apachesolr_search', 'search');
     // Load the default server.
     $env_id = apachesolr_default_environment();
     $environment = apachesolr_environment_load($env_id);
@@ -29,18 +41,13 @@ class DrupalSolrOnlineWebTestCase extends DrupalWebTestCase {
       $instancedir = realpath("$filesdir/solr");
 
       // Copy all files in solr-conf dir to our virtual solr core
-      $pattern = dirname(__FILE__) . '/../solr-conf/*';
-      foreach (glob($pattern) as $conf_file) {
-        copy($conf_file, "$instancedir/conf/" . basename($conf_file));
-      }
-
-      $pattern = dirname(__FILE__) . '/conf/*';
-      foreach (glob($pattern) as $conf_file) {
-        copy($conf_file, "$instancedir/conf/" . basename($conf_file));
+      foreach ($patterns as $pattern) {
+        foreach (glob($pattern) as $conf_file) {
+          copy($conf_file, "$instancedir/conf/" . basename($conf_file));
+        }
       }
 
-      // Copy(dirname(__FILE__) . '/../solr-conf/schema.xml', "$instancedir/conf/schema.xml");
-      $contents = file_get_contents(dirname(__FILE__) . '/../solr-conf/solrconfig.xml');
+      $contents = file_get_contents("$instancedir/conf/solrconfig.xml");
 
       // Change the autoCommit time down to 1 second.
       file_put_contents("$instancedir/conf/solrconfig.xml", preg_replace('@<maxTime>[0-9]+</maxTime>@', '<maxTime>1000</maxTime>', $contents));
@@ -53,6 +60,13 @@ class DrupalSolrOnlineWebTestCase extends DrupalWebTestCase {
       $this->solr_url = $solr_url;
       $this->core_admin_url = $core_admin_url;
       $this->checkCoreStatus();
+
+      if (apachesolr_server_status($environment['url'])) {
+        $this->solr = apachesolr_get_solr($env_id);
+      }
+      else {
+        $this->pass(t('Warning : The solr instance could not be found. Please enable a multicore one on http://localhost:8983/solr'));
+      }
     }
     else {
       $this->pass(t('Warning : The solr instance could not be found. Please enable a multicore one on http://localhost:8983/solr'));
@@ -99,6 +113,25 @@ class DrupalSolrOnlineWebTestCase extends DrupalWebTestCase {
   }
 }
 
+
+class DrupalSolrOnlineWebTestCase extends AbstractDrupalSolrOnlineWebTestCase {
+  /**
+   * Implementation of setUp().
+   */
+  function setUp() {
+    parent::setUp();
+    parent::setUpSolr(
+      dirname(__FILE__) . '/../solr-conf/*',
+      dirname(__FILE__) . '/conf/*'
+    );
+  }
+
+  function tearDown() {
+    parent::tearDown();
+  }
+}
+
+
 class DrupalSolrMatchTestCase extends DrupalSolrOnlineWebTestCase {
   public static function getInfo() {
     return array(
@@ -108,23 +141,18 @@ class DrupalSolrMatchTestCase extends DrupalSolrOnlineWebTestCase {
     );
   }
 
+  function setUp() {
+    parent::setUp();
+  }
+
   /**
    * Test search indexing.
    */
   function testMatching() {
-    // Load the default server.
-    $env_id = apachesolr_default_environment();
-    $environment = apachesolr_environment_load($env_id);
-    if (apachesolr_server_status($environment['url'])) {
-      $solr = apachesolr_get_solr($env_id);
-      $this->assertTrue($solr->ping(), "The Server could be Pinged");
-      $response = $solr->search("*:*", 0, 0, array('qt' => 'standard'));
-      $response = $response->response;
-      $this->assertEqual($response->numFound, 0, "There should not be any documents in the index");
-    }
-    else {
-      $this->pass(t('Warning : The solr instance could not be found. Please enable a multicore one on http://localhost:8983/solr'));
-    }
+    $this->assertTrue($this->solr->ping(), "The Server could be Pinged");
+    $response = $this->solr->search("*:*", array('qt' => 'standard'));
+    $response = $response->response;
+    $this->assertEqual($response->numFound, 0, "There should not be any documents in the index");
   }
 
   /**
