BDD base project: Python + Behave

Overview

code style: prettier

BDD base project: Python + Behave

Basic example of using Python with Behave (BDD). This Gherkin example includes:

  • Basic Scenario
  • Scenario Outline
  • Tagged tests

Table of contents

Get started

Installation

pip3 install -r requirements.txt

on Ubuntu 20.04 (pyvirtualdisplay requirements, we use pyvirtualdisplay to avoid Cloudflare errors in headless mode):

sudo apt-get install xvfb xserver-xephyr tigervnc-standalone-server xfonts-base

How to run the tests

Running tests

behave
2 features passed, 0 failed, 0 skipped
6 scenarios passed, 0 failed, 0 skipped
30 steps passed, 0 failed, 0 skipped, 0 undefined
Took 0m50.056s
  • ./reports/ folder:

    Output

Running tests and generate Allure report

behave -f allure -o reports/allure_report/
  • ./reports/ folder:

    Output

Open Allure report

Note: allure is required.

allure serve reports/allure_report/

HTML report:

Output

Running tagged tests

Running tagged smoke tests

behave --tags=smoke

Running using customized tags

behave --tags='
   
    '
   

more details: running-tagged-tests

Change Browser

edit behave.ini:

...

[behave.userdata]
browser=firefox  # <- CHANGE HERE - Available options: firefox | chrome

...

Change Headless mode

edit behave.ini:

...

[behave.userdata]
headless = true  # <- CHANGE HERE - Available options: true | false

...

Static code analysis tools

Find Problems

Checkers statically analyzes the code to find problems.

bash code_checkers.sh  # run pylint, prospector, black and isort

Tools used:

  • pylint: Pylint is a Python static code analysis tool which looks for programming errors, helps enforcing a coding standard, sniffs for code smells and offers simple refactoring suggestions.

  • black: Black is the uncompromising Python code formatter.

  • isort: Python utility / library to sort imports alphabetically, and automatically separated into sections and by type.

  • prospector: Prospector is a tool to analyse Python code and output information about errors, potential problems, convention violations and complexity.

    Tools executed by Prospector:

    • bandit: Bandit is a tool designed to find common security issues.
    • dodgy: It is a series of simple regular expressions designed to detect things such as accidental SCM diff checkins, or passwords or secret keys hard coded into files.
    • mccabe: Complexity checker.
    • mypy: Mypy is an optional static type checker for Python.
    • pep257: pep257 is a static analysis tool for checking compliance with Python PEP 257.
    • pep8: pep8 is a tool to check your Python code against some of the style conventions in PEP 8.
    • pyflakes: Pyflakes analyzes programs and detects various errors.
    • pyroma: Pyroma is a product aimed at giving a rating of how well a Python project complies with the best practices of the Python packaging ecosystem, primarily PyPI, pip, Distribute etc, as well as a list of issues that could be improved.

Testing

We use tox to validate changes on linux OS (headless mode):

tox

output:

...

2 features passed, 0 failed, 0 skipped
6 scenarios passed, 0 failed, 0 skipped
30 steps passed, 0 failed, 0 skipped, 0 undefined
Took 0m43.177s
_____________________________________________ summary _____________________________________________
  code_checkers: commands succeeded
  py36: commands succeeded
  py37: commands succeeded
  py38: commands succeeded
  py39: commands succeeded
  congratulations :)

to validate changes for a particular Python version (36, 37, 38 or 39), you can do:

tox -e py36

License

MIT

Changelog

  • 1.0.0 - Initial release.
Owner
eccanto
eccanto
Group P-11's submission for the University of Waterloo's 2021 Engineering Competition (Programming section).

P-11-WEC2021 Group P-11's submission for the University of Waterloo's 2021 Engineering Competition (Programming section). Part I Compute typing time f

TRISTAN PARRY 1 May 14, 2022
Experiments with Tox plugin system

The project is an attempt to add to the tox some missing out of the box functionality. Basically it is just an extension for the tool that will be loa

Volodymyr Vitvitskyi 30 Nov 26, 2022
๐ŸŸฅThis is an overview of how to set up and use DataStore3 in your Roblox experiences

Welcome to DataStore3 ๐Ÿ‘‹ This is an overview of how to set up and use DataStore3 in your Roblox experiences What is it? ๐Ÿค” DataStore3 is a service tha

Reece Harris 7 Aug 19, 2022
An end-to-end Python-based Infrastructure as Code framework for network automation and orchestration.

Nectl An end-to-end Python-based Infrastructure as Code framework for network automation and orchestration. Features Data modelling and validation. Da

Adam Kirchberger 15 Oct 14, 2022
Provide error messages for Python exceptions, even if the original message is empty

errortext is a Python package to provide error messages for Python exceptions, even if the original message is empty.

Thomas Aglassinger 0 Dec 07, 2021
Data Applications Project

DBMS project- Hotel Franchise Data and application project By TEAM Kurukunda Bhargavi Pamulapati Pallavi Greeshma Amaraneni What is this project about

Greeshma 1 Nov 28, 2021
Extremely unfinished animation toolset for Blender 3.

AbraTools Alpha IMPORTANT: Code is a mess. Be careful using it in production. Bug reports, feature requests and PRs are appreciated. Download AbraTool

Abra 15 Dec 17, 2022
This is the DBMS Project done in 5th sem of B.E CS.

Student-Result-Management-System This is the DBMS Project done in 5th sem of B.E CS. You need to install SQlite DB Browser in your pc or laptop to ope

Vivek kulkarni 1 Jan 14, 2022
Snek-test - An operating system kernel made in python and assembly

pythonOS An operating system kernel made in python and assembly Wait what? It us

TechStudent10 2 Jan 25, 2022
Team Hash Brown Science4Cast Submission

Team Hash Brown Science4Cast Submission This code reproduces Team Hash Brown's (@princengoc, @Xieyangxinyu) best submission (ee5a) for the competition

3 Feb 02, 2022
An Airdrop alternative for cross-platform users only for desktop with Python

PyDrop An Airdrop alternative for cross-platform users only for desktop with Python, -version 1.0 with less effort, just as a practice. ##############

Bernardo Olisan 6 Mar 25, 2022
This is a multi-app executor that it used when we have some different task in a our applications and want to run them at the same time

This is a multi-app executor that it used when we have some different task in a our applications and want to run them at the same time. It uses SQLAlchemy for ORM and Alembic for database migrations.

Majid Iranpour 5 Apr 16, 2022
Tethered downgrade 64-bit iDevices vulnerable to checkm8

ra1nstorm Tethered downgrade 64-bit iDevices vulnerable to checkm8 Since the purpose of this tool is to tethered downgrade a device, after restoring p

mini_exploit 65 Nov 08, 2022
A bash-like intrepreted language

A Bash-like interpreted scripting language.

AshVXmc 1 Oct 28, 2021
CaskDB is a disk-based, embedded, persistent, key-value store based on the Riak's bitcask paper, written in Python.

CaskDB - Disk based Log Structured Hash Table Store CaskDB is a disk-based, embedded, persistent, key-value store based on the Riak's bitcask paper, w

886 Dec 27, 2022
Glyph Metadata Palette

This plugin for Glyphs3 allows you to associate arbitrary structured metadata to each glyph in your font.

Simon Cozens 4 Jan 26, 2022
Contain the customization I made for my Linux rice.

dotfiles Contain the customization I made for my Linux rice. Credit and Respect Polybar Autohide Fulltime Rofi by adi1090x (only include my personal r

sora 3 Apr 04, 2022
A repository of study materials related to Think Python 2nd Edition by Allen B. Downey. More information about the book can be found here: https://greenteapress.com/wp/think-python-2e/

Intro-To-Python This content is based on the book Think Python 2nd Edition by Allen B. Downey. More information about the book can be found here: http

Brent Eskridge 63 Jan 07, 2023
Library support get vocabulary from MEM

Features: Support scraping the courses in MEM to take the vocabulary Translate the words to your own language Get the IPA for the English course Insta

Joseph Quang 4 Aug 13, 2022
An extension module to make reaction based menus with disnake

disnake-ext-menus An experimental extension menu that makes working with reaction menus a bit easier. Installing python -m pip install -U disnake-ext-

1 Nov 25, 2021