How karimelkomy/python-test-automation-framework works
Project type and purpose
• This is a Python-based Selenium Test Automation Framework built around the Page Object Model.
• Primary use cases: writing UI tests, generating Allure reports, and updating TestRail statuses automatically.
Main architectural components
• Test Runner Layer (tests/, conftest.py)
• pytest-based test scripts with decorators for Allure and TestRail.
• Fixture & WebDriver Layer (conftest.py → base/webdriverfactory.py → base/selenium_driver.py)
• Creates, configures, and tears down browser sessions.
• BasePage Layer (base/basepage.py)
• Provides common actions (click, sendKeys, locator resolution).
• Page Object & Navigation Layer (pages/, navigation/)
• pages/: classes for each page’s actions and verifications (LoginPage, DashboardPage, etc.).
• navigation/: shared navigation flows (e.g., goToLoginPage).
• Locator & Test Data Layer (locators/, test_data/)
• locators/locators.json: element definitions (pageName, locator, method).
• test_data/test_data.json & testData.py: environment, credentials, inputs.
• Utilities Layer (utilities/)
• custom_logger.py, read_json.py, read_excel.py, locators_read.py, teststatus.py, util.py.
• Logging, data readers, pass/fail marking, TestRail API calls.
• Reporting & Integration
• Allure: test-step reporting via pytest plugin.
• TestRail: test status updates via testrail.cfg and pytest flag.
• External Dependencies
• Browsers (managed by Selenium WebDriver).
• pytest, JSON/Excel libraries.
• CI/CD (CodeShip) – optional.
Component interactions & data flow
• Test Runner invokes pytest tests →
↳ conftest fixtures instantiate WebDriver via WebDriverFactory → SeleniumDriver → Browser
↳ Tests call Navigation/Page classes → BasePage methods → SeleniumDriver → Browser actions
↳ Page & Navigation classes read locators from locators.json and test data from test_data.json
↳ Utilities record logs and mark pass/fail via teststatus → optionally call TestRail API
↳ pytest writes results → Allure plugin generates HTML reports
Key architectural patterns & principles
• Page Object Model: separation of test logic from UI operations.
• Single Responsibility: each module has a focused role.
• Data-driven design: external JSON for locators and test data.
• Pluggable integrations: easily add or remove reporting/TestRail/CI.