Member-only story
BDD Automation testing using Selenium and Python
Behaviour-driven Development is an agile software development technique. It helps in collaboration between developers, QA and non-technical business users or customers. Here scenarios are written in simple english terms unlike the other traditional approaches.
Python uses Behave to write the tests in BDD style. The two most important items of Behave are feature files and steps.
Feature files are the files where test scenarios are written. Gherkin language is used to write the keywords in feature files. Feature files are placed inside features directory. Following is an example of a feature file. Feature files have .feature extension.
It starts with the keyword Feature. Value of the feature will signifies the purpose of the all the test scenarios. Here the feature is to validate different login scenarios.
Background contains the steps which are common to all the scenarios.
Scenario keyword is used to declare a complete scenario. Inside a scenario all the steps of that scenario are written.
Steps are declare using Given, When, Then, And & But keywords. Even though…