Writing Test Cases in BDD (Gherkin) Format

In recent times, many organizations have made a significant shift towards Agile development practices, including Behaviour Driven Development (BDD). BDD was created to address the challenges arising from poorly defined requirement specifications and to foster better collaboration between business and QA professionals.

By implementing BDD, teams aim to align their understanding of project requirements and ensure that everyone is on the same page. BDD incorporates principles from Test-Driven Development (TDD) and Acceptance Test-Driven Development (ATDD), focusing on communication and delivering valuable software efficiently. This approach allows teams to deliver high-quality software that meets business needs more effectively.

To write a Test Case script using BDD in Vansah follow the steps below:

1. Open the given Test Case.

2. Go to the Test Script Tab.

3. Update the Test Script type to: BDD – Gherkin

Now you can write your BDD Script within the editor using the BDD keywords available

 

Given: Specifies the initial state or preconditions of the scenario.

When: Describes the action or event that triggers the behavior being tested.

Then: Defines the expected outcome or result of the scenario.

And: Used to add additional steps or conditions within a scenario.

Note that these key words are case sensitive. Using key words in lower case will prevent the user from saving the Test Script, and an error message will be displayed.

Once the syntax is corrected, the Test Script can be saved successfully.

Related Articles