How to write Test Cases for Filters
In this how-to, we will walk through how to write test cases for filters. Many applications make use of dropdown filters. Some examples include Google Spreadsheets, Twitter, Amazon, and any modern application. As a result, creating test cases for filters applies to most testers. Follow along with this how-to and finish your application’s first test case by creating your account in our free test case management tool. Before starting our test case, we need to define the Acceptance Criteria.
What are the Acceptance Criteria for our filters?
As discussed in our requirements post, we must have functional requirements. So let’s go ahead and define them as such:
Description: “As an online retailer, users must be able to select and filter the category of product they are searching.”
- Display a complete list of product database categories in the filter dropdown.
- Show products tagged with the same category as selected in the dropdown.
What are the Filters Test Scenarios?
We will want to document several test scenarios to create test cases for filters successfully. At a high level, they will include:
- Verify clicking the filter dropdown expands the filter.
- Verify unselecting the filter area collapses the filter.
- Ensure application allows displaying filter options prior to searching.
- Verify search results before applying filters are accurate and complete.
- Validate filtering is optional and not required.
- Verify filter functionality is displayed appropriately per business requirements (some requirements may stipulate filtering occurs after retrieving results).
- Check if the filter is displayed when database errors are thrown in search results.
- Verify values in the filter match the full list available per the database.
- Verify maximum text length in the database can be displayed in the filter area.
- Validate selecting a filter returns results that match the selected filter.
- Verify results outside of the selected filter are not returned.
- Ensure the filter is responsive on desktop, laptop, tablets, and mobile phones.
- Ensure the filter UI works properly on all browsers your team is certifying (if web application).
- Verify if filtering options can be changed after making a selection.
- Verify selected filter can be cleared.
- Depending on business requirements, verify if a custom criteria filter can be applied.
- Validate filter options are persisted from session to session – depending on business requirements.
- Verify that returned results can be sorted by relevance.
- Verify that returned results can be sorted by keywords.
- Check filter options can be hidden if the user desires.
- Validate if filter options can be applied without any search query being entered.
- Ensure the filter is included on all pages when results have pagination.
- Verify search filter corrects any typos.
Keep in mind there are diminishing returns to testing, and developers should be using a thoroughly tested library for filters. However, there is no need to over-test scenarios. For example, if the filters are working on multiple devices, it is unlikely to turn up any bugs to continue testing device permutations.
Writing Test Cases for Filters
In this future section, we will go into detail on how to write the functional test case for filters. If you already have your free AccelaTest account and want to be added to this complete test case, please email us at email@example.com.