How argodevops/pybehave-selenium-test-framework works
Project Type & Purpose
• This is an open-source BDD-style test automation framework built on Python.
• It provides UI testing via Selenium WebDriver, API testing via Python requests, and data-driven support via Jinja templates.
• Key audiences: QA engineers writing feature tests and framework developers extending core behavior.
Main Architectural Layers
A. Test Suite Layer (User-facing)
– Gherkin feature files (pybehave/features/*.feature)
– Step definitions (pybehave/features/steps/*_steps.py)
– Environment setup (features/environment.py)
B. Framework Layer (Core platform)
– Facades (support/facades/*) – high-level test logic combining multiple actions
– Page Actions (support/pageactions/*) – Page Object Model implementations
– Core ElementAction (support/core/elementaction.py) – low-level Selenium calls with retry/back-off
– API Client Actions (support/apiclientactions/apiclient.py) – HTTP request wrappers
– Builders & Templates (support/builders/*) – Jinja2-based payload generation
– Locators (support/locators/*) – abstraction of element selectors
– Configuration & Utilities (support/config.py, utils/*) – settings reader, vault integration, logging
External Systems & Artifacts
– Web browsers (Chrome, Edge) driven by WebDriver binaries in drivers/
– Remote Selenium Grid (optional) via a Hub URL
– Target applications under test (UI endpoints, API endpoints, test databases)
– Reporting & Logging: Allure, behave JSON (reports/), screenshots (screenshots/)
Interactions & Data Flow
1. Behave CLI / Docker container starts → reads test-settings.json & default config
2. Behave runner kicks off each feature file → matches steps to Python step functions
3. Step functions call into Facade classes → orchestrate UI/API flows
4. Facades delegate to:
• Page Actions → ElementAction → WebDriver → Browser → Target UI
• API Client → HTTP Requests → Target API
• Database Actions → DB client → Test DB (if applicable)
• Builders → read template → produce test payloads
5. Core ElementAction handles retries, waits, screenshots on failure
6. All actions logged and emitted to Behave reporters → Allure/JSON + screenshots
Architectural Patterns & Principles
• Layered separation (Test Suite vs. Framework)
• Page Object Model (support/pageactions + locators)
• Facade pattern (high-level test flows)
• Retry/back-off strategy in core element actions
• Pluggable drivers (local binaries vs. Selenium Grid)
• Data-driven via templates and config readers
Extensibility Points to Highlight
– Adding new browser drivers (drop into drivers/)
– New page actions & locators for additional pages
– Additional ApiclientActions or Database actions
– Customizing config via test-settings.json or key vault