Skip to content

A portfolio example of Selenium tests written in Python. The tests are written in Behave (Gherkin) BDD style which produces self documenting feature files.

Notifications You must be signed in to change notification settings

Jiff21/python_selenium_behave_bdd

Repository files navigation

BDD Python Selenium Behave

Introduction

A portfollio example of python selenium tests. I'm a big fan of Gherkin Syntax and Behave is one of my favorite tools to write BDD Tests. The feature files offer a quicker grasp of what's expected and where something stopped working, compared to to reading through all the test functions to catch up.

See products.feature or any of the other feature files, to get an idea how easy figure out what's going on. If you're unfamiliar with behaves folder structure go to the steps directory for code samples.

I used a variety of differing selectors, interaction methods & waits to demonstrate my knowledge of selenium. I chose to write the tests against a saucelabs demo site to minimize maintenace.

Install

Dependancies

  • Python 3.
  • Virtualenv (pip3 install virtualenv).

Install steps

virtualenv -p python3.6 env
source env/bin/activate
./utilities/driver_update/geckodriver.sh
./utilities/driver_update/chromedriver.sh
pip3 install -U -r requirements.txt

Or just run ./install.sh

Running Tests

behave features

Allure reports

For a prettier report checkout Allure reports with the steps below.

Install

brew install allure

Run

behave -f allure_behave.formatter:AllureFormatter -o utilities/allure/allure_results ./features

Generate and run reports.

allure generate utilities/allure/allure_results/ -o utilities/allure/allure-reports/ --clean
allure open utilities/allure/allure-reports/

If you want a History section next time you run, you need to copy the history from the previous report, before generating the next report.

rm -R utilities/allure/allure_results/*
cp -R utilities/allure/allure-reports/history/ utilities/allure/allure_results/history

About

A portfolio example of Selenium tests written in Python. The tests are written in Behave (Gherkin) BDD style which produces self documenting feature files.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published