https://github.com/andreasneuber/python-cucumber-selenium-example
Sample implementation for Python Behave.
https://github.com/andreasneuber/python-cucumber-selenium-example
bdd behave cucumber python3 testautomation
Last synced: 6 months ago
JSON representation
Sample implementation for Python Behave.
- Host: GitHub
- URL: https://github.com/andreasneuber/python-cucumber-selenium-example
- Owner: andreasneuber
- License: mit
- Created: 2022-10-24T21:23:15.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2025-07-02T21:09:22.000Z (7 months ago)
- Last Synced: 2025-07-02T22:23:27.807Z (7 months ago)
- Topics: bdd, behave, cucumber, python3, testautomation
- Language: Python
- Homepage:
- Size: 34.2 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# python-cucumber-selenium-example
Sample implementation of Python Behave
## Application under test
The feature files, step definitions and page objects were written for https://github.com/andreasneuber/automatic-test-sample-site.
Readme in that repo has further details how to set it up.
## Setup - Windows 11 machine
- IDE used: PyCharm
- Install Python, with Windows installer - https://www.python.org/downloads/windows/
- In Pycharm set your new local Python executable as Interpreter
- Create a virtual environment: `py -m venv .venv`
- Activate virtual environment: `.venv\Scripts\activate`
- Double-check virtual environment: `pip --version`
- Install required Python packages: `pip install -r requirements.txt`
## Run all tests locally
`behave`
## Run specific tests locally
`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`
## Run locally with Allure reports
Install Allure: https://docs.qameta.io/allure/#_get_started
`behave -f allure_behave.formatter:AllureFormatter -o ./reports/allure ./features`
`allure serve reports/allure`
## More Configuration Possibilities
https://behave.readthedocs.io/en/stable/behave.html#configuration-files
## Updating Behave
`pip install -U behave`
## Wait Mechanism
Important subject - currently example uses functionality of the selenium-page-factory package.
### See also
https://github.com/the-creative-tester/python-behave-web-browser-automation-example
https://selenium-page-factory.readthedocs.io/en/latest/