Using Behave and Selenium WebDriver in Python
Behave is a BDD framework available in Python. It provides a very similar approach to Cucumber.
In this recipe, we will see how to use Behave and Selenium WebDriver to test a fund transfer application.
Getting ready
You need to install Behave using the following command:
pip install behave
How to do it...
In Behave, we need to create a features file for the stories under test. These stories are written in the Gherkin language with the Given, When, and Then structures in the Cucumber format. Perform the following steps to create a feature and step definition file with Behave:
- Create a folder named
fundtransferand then create two subfolders,featuresandsteps, in thefundtransferfolder. - In the feature folder, create a plain text file named
fundtransfer.feature, as follows:Feature: Customer Transfer's Fund As a customer, I want to transfer funds so that I can send money to my friends and family Scenario: Valid Payee ...