The following tests cases should be written in order to have a consistent view for new patches that might possible change current functionality
Tests that already exist are already marked

Base Framework (Solr disabled)

Enable module
apachesolr.index.inc should not be loaded everywhere
Search index should show a notice that no solr instance is connected
SolrBaseQuery unit test
SolrFilterSubQuery unit test
ApacheSolrDocument unit test
Changing Content type
Adding/Modifying taxonomy term
Add a user, add content as that user and modify content

Base Framework (Solr enabled)

Connection should be succesful
DrupalApacheSolrService unit test
Index should be empty
Send test content & verify (UTF-8 included)
Modify content & verify
Delete content & verify
index status should be correct with the indexed content
Solr config files should be listed properly
Number of items per cron run should work
On failure, the configured result should show
Delete index
Reindex index
Simple facet testing ? // Not possible, need facetapi for that

Search Environment

Editing an environment
Cloning an environment and delete
Create a new environment and delete
Change read and write setting and verify
Add a new environment and make it default

Search Pages

Core search page available
Editing the core_search page
Clone the core_search page
Create a new search page and delete
Change search page title
Test search page types (taxonomy) // Not able to check properly without solr
Change search page path
Add a custom filter // Not able to check properly without solr
Change results per page // Not able to check properly without solr
Enable/disable spell check // Not able to check properly without solr
Empty search behavior // Not able to check properly without solr

Bias

Analyze content and validate helper functions
Exclude content type

More like this

Add a more like this block
Remove a more like this block
Validate configuration of more like this block

Node Access (Solr Enabled)

Index testing content without access rules
Index testing content with access rules
Change permission, validate if being reindexed

Comments

nick_vh’s picture

Status: Active » Needs review
StatusFileSize
new14.97 KB

First patch.

Base Framework (Solr disabled)

Enable module
Search index should show a notice that no solr instance is connected
SolrBaseQuery unit test
SolrFilterSubQuery unit test??
ApacheSolrDocument unit test

It seems that the SubQuery test doesn't load and when I try to execute it it is failing. Waiting on response for the status of this subQuery class. Continueing now for the Base Framework tests with Solr enabled

Setting the status on needs review so the test bot can execute all of these tests

Status: Needs review » Needs work

The last submitted patch, 1397138-1.patch, failed testing.

nick_vh’s picture

Status: Needs work » Needs review
StatusFileSize
new14.87 KB

Updating, so it does not require apachesolr.module or any db queries to run the apachesolr document unit test

nick_vh’s picture

+ add test that verifies we are not loading the apachesolr.index.module on every or certain page loads

nick_vh’s picture

Issue summary: View changes

Some more information

nick_vh’s picture

StatusFileSize
new36.09 KB

Added test to verify this apachesolr.index.module + better subquery tests

nick_vh’s picture

StatusFileSize
new36.1 KB

Forgot a dsm and reverted a function from private to public. Fixed now

nick_vh’s picture

Issue summary: View changes

new tests

nick_vh’s picture

StatusFileSize
new45.4 KB

Added interface as separate file to the patch

nick_vh’s picture

Issue summary: View changes

Updated issue summary.

nick_vh’s picture

Issue summary: View changes

Updated issue summary.

Status: Needs review » Needs work

The last submitted patch, 1397138-7.patch, failed testing.

nick_vh’s picture

Status: Needs work » Needs review
StatusFileSize
new46.28 KB

Added test to clone a search environment

Status: Needs review » Needs work

The last submitted patch, 1397138-8.patch, failed testing.

nick_vh’s picture

StatusFileSize
new48.7 KB

I had to modify the way of the operator in the FilterQuery parser :
Now :

protected function rebuildFq() {
    $fq = array();
    foreach ($this->fields as $pos => $field) {
      $fq[] = $this->makeFilterQuery($field);
    }
    foreach ($this->subqueries as $subquery) {
      $subfq = $subquery->rebuildFq();
      if ($subfq) {
        $operator = $this->operator;
        $fq[] = "(" . implode(" $operator ", $subfq) . ")";
      }
    }
    return $fq;
  }

Before :

protected function rebuildFq() {
    $fq = array();
    foreach ($this->fields as $pos => $field) {
      $fq[] = $this->makeFilterQuery($field);
    }
    foreach ($this->subqueries as $subquery) {
      $subfq = $subquery->rebuildFq();
      if ($subfq) {
        $operator = $subquery->operator;
        $fq[] = "(" . implode(" $operator ", $subfq) . ")";
      }
    }
    return $fq;
  }

This has as a consequence that subqueries now have to define their operator in the AddFilterQuery :

$query1 = apachesolr_drupal_query('DrupalTest');
    $query2 = apachesolr_drupal_query('DrupalTest');
    $query2->addFilter('label', 'bar');
    $query3 = apachesolr_drupal_query('DrupalTest');
    $query2->addFilter('label', 'baz');
    $query1->addFilterSubQuery($query2, 'OR');
    $query2->addFilterSubQuery($query3);
    // This equals (label:bar OR (label:baz)) (URL = ?fq=(label:bar OR (label:baz)))

    // multiple filters in first query
    $query1 = apachesolr_drupal_query('DrupalTest');
    $query1->addFilter('is_uid', '10');
    $query2 = apachesolr_drupal_subquery();
    $query2->addFilter('is_uid', '1');
    $query2->addFilter('tid', '5');
    $query1->addFilterSubQuery($query2, 'OR');
    // This equals is_uid:10 (is_uid:1 OR tid:5)  (URL = ?fq=is_uid:10&fq=(is_uid:1 OR tid:5))
    

The first example is easy to make with the previous code, the second example is nearly impossible unless you use an empty base query where you add subqueries to.

nick_vh’s picture

Issue summary: View changes

Updated issue summary.

nick_vh’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 1397138-11.patch, failed testing.

nick_vh’s picture

StatusFileSize
new51.45 KB

After some mysql performance problems there is some update of the testing suite. Now all the tests available should succeed. Let's cross fingers!

nick_vh’s picture

Status: Needs work » Needs review
nick_vh’s picture

Issue summary: View changes

Strike through of clone button

nick_vh’s picture

StatusFileSize
new54.48 KB

Adding search pages tests

nick_vh’s picture

Issue summary: View changes

Updated issue summary.

nick_vh’s picture

StatusFileSize
new55.3 KB

Added a clone search page test

nick_vh’s picture

Issue summary: View changes

Updated issue summary.

pwolanin’s picture

Status: Needs review » Needs work

per discusison need to leave the operator logic as-is

seems like we need some documentation

nick_vh’s picture

Status: Needs work » Needs review
StatusFileSize
new56.28 KB

Reverted the operator logic and all that came along with it. Attached is the last patch for today regarding the simpletests.

nick_vh’s picture

Issue summary: View changes

Updated issue summary.

nick_vh’s picture

Issue summary: View changes

Updated issue summary.

nick_vh’s picture

Status: Needs review » Needs work

Committed what we have so far. Addons always welcome

nick_vh’s picture

Issue summary: View changes

Updated issue summary.

nick_vh’s picture

Committed all #19 to 6.x-3.x

nick_vh’s picture

Status: Needs work » Fixed

More simpletests will go in as separate issues. Closing this one

nick_vh’s picture

Status: Fixed » Needs work

Hmm, second thoughts, reopening

nick_vh’s picture

Status: Needs work » Closed (fixed)

We can always add more when needed. Closing as a final thought :-)

nick_vh’s picture

Issue summary: View changes

Updated issue summary.