Sample implementation of Python Behave
The feature files, step definitions and page objects were written for https://github.com/andreasneuber/automatic-test-sample-site-py.
Readme in that repo has further details how to set it up.
- IDE used: PyCharm
- Install Python, with Windows installer - https://www.python.org/downloads/windows/
- Create a virtual environment:
py -m venv .venv - In PyCharm set your new local Python executable as Interpreter
- Activate virtual environment:
.venv\Scripts\activate - Double-check virtual environment:
pip --version - Install required Python packages:
pip install -r requirements.txt
behave
behave --tags=data_table
or
behave --tags=inlineVars
or
behave --tags=background
or
behave --tags=scenarioOutline
or
behave --tags=horizontalTable
or
behave --tags=verticalTable
or
behave --tags=verticalTableLong
Install Allure: https://docs.qameta.io/allure/#_get_started
behave -f allure_behave.formatter:AllureFormatter -o ./reports/allure ./features
allure serve reports/allure
Toggle HEADLESS: bool in config/base.py between True (headless) and False (visible browser).
https://behave.readthedocs.io/en/stable/behave.html#configuration-files
pip install -U behave
Important subject - currently example uses functionality of the selenium-page-factory package.
https://github.com/the-creative-tester/python-behave-web-browser-automation-example