How to test Standard Search in Drupal
It’s not a secret that QA engineers work with technical specifications, but sometimes there are no specs regarding the search functionality on a site and you end up with something like “Default search module”, or your PM will just say - “Simple search, nothing to test”. In this situation you can use only your imagination. This blog post is for those quality assurance engineers who might not know what “Standard Search in Drupal 7” really means, or how to test it.
First thing you should know about the Standard Search in Drupal 7 is the way it indexes content. The content can either be reindexed manually, or be automatically marked for reindex after you add it (or edit existing content). The content that’s queued for reindexing will be indexed when cron runs. This can happen automatically through the use of a specific schedule, or, for testing purposes, you can run it manually from the Admin UI.
To run cron, you have 2 options:
- Use the Administration Menu module - hover over the home icon in the toolbar and click Run cron.
- Go to Reports > Status report (admin/reports/status), and under Cron maintenance tasks click run cron manually.
Note: If you use Apache Solr for your Search system, it may be not enough to just run cron once. It usually needs an additional 2 minutes after “run cron” to re-index results.
The best way to start testing is getting to know the search configurations done on the site. If you go to configuration-> search and metadata ->search settings, you’ll find the configurations implemented for your search. Now, lets see them more closely.
1. Drupal Search allows users with Use search permission to search for content and users separately. By default, both Node and User searches are active. In order to search for users, the user should have permission to view user profiles.
2. By default Minimum word length to index is set to 3, that means that you will not be able to do a search if you don’t have at least one 3-character word in your search query.
This also means that if you search for nodes with title ”How to find a bug” you can find it by using the keywords: “find”, “bug” and “how”.
You should get results in the following cases:
- Whole title (ex: how to find a bug)
- Long words (ex: find)
- Long word and short word (ex: to find )
You should get a validation error for:
- Only short words (ex: to a)
You should get “No results” for:
- one long word and one word not from this sentence (ex: bug report)
Also search is indexing (saving) keywords separated by spaces. The following examples will not return any results:
- half or part of the word (ex: fin)
- words without spaces between them (ex: howtofind)
- words separated by underscores or something else (ex: how_to_find_a_bug)
Results should appear for these cases:
- With multiple spaces between words (ex: how to find a bug)
- Or in reverse order (ex: bug a find to how)
4. Lower/upper cases - Test your search by entering words with upper and lower cases (ex: InTerVIEw). This should work out of the box in case-insensitive mode.
5. Don’t forget that this search should work not only with titles, but with all content bodies as well. Make sure to search for some keywords from the content, maybe you’ll find a little bug. You never know.
6. Permissions - To know what permission the users have, go to Modules-> Search-> Permissions (or People and select the Permissions tab).
By default, all users (Anonymous + authenticated) can view published nodes, so they should appear in the returned results (if you allow anonymous users to search, of course). In this case just unpublish the node and then enter its title in the search field. You know what result you should get.
I hope this information will make your testing easier and more pleasant! Happy New Year!
Tags: DrupalDevelopmentCheck this option to include this post in Planet Drupal aggregator: planetTopics: Tech & Development