Test Scenarios For Search Functionality In Drupal

December 11, 2020 | 8 Minute Read

Tags:Drupal,Drupal QA,Quality Assurance

Search

Search is a technique used to find the position of any element or value in the list. The search is successful or unsuccessful depends on whether the term or element being searched is found or not.

Search Engines

A search engine is a tool that enables users to find information on the World Wide Web. A search engine intends to get the requested information from the vast database available on the internet.

Every web application, by default, will contain a search feature in it. Search facilities are implemented in each website differently based on the requirement and nature of the application.

Search For websites

Here are a Few Scenarios that we must keep in mind for Testing Website Search Functionality:

Placement & UI of Search Bar


  • Having a good and effective website Search Bar location is essential. Usually, it is in the Header section of the website.
  • Can the Placeholder text be enabled within the Search box and does it vanish when users start typing?
  • Is font family used in search keywords matching the overall theme and layout?
     

Site Search Suggestions


Drop down search options for Roger
  • Does your website search have an auto-complete feature?
  • Do the suggestions appear updated as expected when you enter/remove a keyword?
  • Are the search results relevant to the searched keyword? What happens when you click on any suggestion? Does it get redirected to the proper result page?
     

Advance Search Feature


Advanced search options are additional filters that can be used by users to perform a search that will limit the results to web pages only, or videos, images, map directions, news, etc.

  • Does your website have the Advance Search feature?
  • Are there any options and extra features the search feature provides? Do the features work properly and produce relevant search results? Eg. Exact Search (lets you search for the exact entered search term), OR Search (lets you search for multiple separate search terms), Exclusive Search (lets you exclude certain search terms), Filetype Search (lets you search for the exact file type), etc. 
  • Combining different search criteria must produce proper results. Eg. Coffee AND (French Press OR Espresso) will give search results for Coffee and French Press and Coffee and Espresso.  
  • If there are no results for the Advance Feature Search, the particular criteria should be hidden. 
     

Search Result


  • What happens when you click on the Search button without entering any keyword?
  • Is history maintained for the previously searched keywords?
  • Is the search relevant to the searched keyword?
  • Does the result page title contain the searched keyword?
  • What is the number of search results displayed per page? Does the pagination come into play when you have more results per page?
  • What is the order in which the search result is organized? Can you change the order like Most Relevant or More Recent? 
  • Can users search again from the result page itself?
  • What is the behavior when users search for keywords that give no result?
  • What happens when you search for a wrong keyword, like a keyword having a spelling mistake. No search results should be displayed.
  • Do we get search results if the keywords are in Uppercase as well as the Lower Case? 
  • What happens if space is not entered between different keywords?
  • Search results should not display Private Content.
  • Search results should not display content that is not in Published state.
  • If the site does not support a multilingual search, the entered keyword should not display any result. Eg. For English, if the german Keyword is entered, no search results should be displayed. 
  • Search results on multilingual sites should display results according to the language in which the keyword is entered.
     

Responsive is Must


  • Are you able to see each and every feature of Search in responsive mode?
  • How user-friendly is Search in Mobile devices? 
  • Does Advance Search work as expected on Mobile devices?
  • Are all the images and visuals in the Search Result displayed as expected “as per the designs” in the responsive screen?
     

Drupal Search Module

The Drupal Search Module helps the user search for specific content on the site. Search can be performed for both users and particular words. Under ‘Content,’ users will be able to search for words that are present in the default rendering of node content on the site, which would include the default display of any CCK (Content Construction Kit: it's a module that allows users to create new content types and extend existing content types). It also allows users to add/modify/remove fields from these content types where these fields may be text, numbers, dates, images, computed values, references to other content, taxonomies, the location fields, etc., as well as comments. Navigating to the “users” tab of Search, we can see the registered users' names on the site and their permissions and email addresses. 
 

Search Query Types

Search queries can be written in different ways. Search can be handy by adding a few keywords or symbols.

AND Search


Search for basic AND Article

To get results that match multiple words, users can just type the words that you want to find using AND. This is the default manner in which Drupal's search works.

OR Search


Search for basic OR Article

In order to search for data that may contain one or a few terms, enter the keyword OR between each search term: "dogs OR cats" or "dogs OR cats OR birds."

Exclusionary Search


Search for basic - Article

To filter for things that don't exist, Drupal allows users to use the minus “-” sign. For example, "pet stores -rabbit" finds all nodes with "pet" and "stores" that do not also contain the words "rabbit."
 

Advanced Search


Advanced Search helps the user's search for any work in the Search term or just a phrase or both. Users can remove the words that are not needed and choose content types inside which the search is limited. 


Indexing

  • The text content of the nodes in Drupal is indexed in Drupal's search engine. “Cron Run” is used to choose the interval of the search engine indexes. Cron (short for Chronograph) is not a part of Drupal. It's a scheduler that is there on your server and runs tasks (called "cron jobs") at specific intervals. The jobs can run hourly, daily, weekly, or as desired. 
     
  • When the Cron job is run, the server visits the “Cron page” (users have to visit the Status Report to find the exact URL of the Cron Page to use on your site for external runs of cron). Whenever the user opens the Cron URL, the search engine will start indexing. So, the Cron job has to be set up for the search engine to work. Search settings, users can limit the number of items that should be indexed in a single cron run. Path: administer >> configuration >> search and metadata >>Search Pages
     
    indexing in Drupal search engine


Reindexing

  • Whenever the user makes any changes related to the content like Add, Edit, or Delete, these content items are marked for indexing or reindexing the next time cron runs. When the content is reindexed, the previous content indexing does not change till the next time cron is run. At this time, the content is replaced by the new content. 
     
  • The changes related to your site's structure do not cause affected content to be marked for reindexing. Eg. Delete or edit the taxonomy terms, enable or disable modules, and modify your content types' fields or display parameters. 
     
  • There is a “Re-index” button on the Search settings page that can be used to ensure that the Search index is up to date after these changes are done.
     
    search pages for reindexing in Drupal
  • Search Results will not be displayed in case the Search API is down. Make sure the Search API is up and running before performing the search operation. The Search API Module should be installed. It can be checked on this path: /admin/config/search/search-api
     
  • If all the content is not reindexed, the content will not show in the search results. If the reindexing fails, users can run Cron from this path: /admin/config/system/cron. Cron takes care of running periodic tasks like checking for updates and indexing content for search.


Accessing Search

  • For accessing the Search Page user can place the Search Form under admin >> structure >> blocks and choose where to display it. 
  • The Search Module can also be placed among the primary or secondary links or any other menu items. 
  • Search Module can also be added to the Navigation Menu. 
search module
sidebar first in search module
search bar
search bar in home screen

In Drupal, by default, anonymous users cannot perform the search. Admin can decide who can do searches and who can administer the search settings. This can be done by navigating to admin/people.

In conclusion, the demand for search is growing day after day, and by considering the above requirements, we can help the end-users effectively.