TABLE OF CONTENTS
2. Understanding Feature File Generated in Gherkin-based language
3. Best Practices for Creating Feature Files
1. Overview
The algoQA platform adheres to the behavior-driven development (BDD) framework for generating Feature Files. These files are text documents used to describe specific functionalities of your application that require testing, written in the Gherkin-based language. Test cases are generated in English like the Gherkin language. Gherkin's plain-text format allows users to describe an application's behavior by outlining scenarios and steps in a language that's easy to understand.
2. Understanding Feature File Generated in Gherkin-based language
In the algoQA platform generated Feature File, it is important to understand the Gherkin syntax, which is the language used for describing an application’s behavior in plain English.
Gherkin has a simple syntax that includes the following key elements:
Element | Description |
Feature | Describes the overall feature that is being tested |
Scenario Name | Describes a specific situation or test case within the feature |
Test case tags | Allows tagging of scenarios to group them based on their purpose or functionality. |
Scenario Outline | Provides a brief test case summary or description as an outline given during recording of the scenario using Follow Me feature. |
Given | Describes the initial state of the user for a given scenario |
When | Describes the action of the user or event that triggers the behavior being tested. |
Then | Describes the expected outcome or result of the scenario |
And | Allows you to add additional Given, When, or Then statements to a scenario |
But | Allows you to add an exception or negative case to a scenario |
Examples | Allows you to define a set of inputs and expected outcomes in a tabular format |
2.1 Example
Consider a scenario where currency is to be verified for various countries.
During profiling, configure the country and currency as shown in the following screenshot:
The algoQA generated Feature File is as shown:
3. Best Practices for Creating Feature Files
To create feature files that effectively describe the behavior of your application and are easy to understand, follow these best practices:
- Use meaningful and descriptive feature, scenario names and scenario outlines. Use persona to describe scenario and scenario outlines.
- Include multiple verification steps in each scenario to thoroughly test the behavior of the system. This ensures that the expected outcomes are met and helps in identifying any discrepancies or issues.
- Instead of using hardcoded wait times in your tests, consider using dynamic wait actions. This allows the tests to wait for elements to become available before performing actions.
- When verifying the state of elements on the page, use "Verify content" action instead of "Verify display" action.
- Use tags to organize and group scenarios for performing batch execution which reduces execution time.
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article