|
|
||
|---|---|---|
| common | ||
| config | ||
| core | ||
| data | ||
| frontend | ||
| page_objects | ||
| tests | ||
| .gitignore | ||
| PixPin_2025-09-15_15-18-02.png | ||
| README.md | ||
| conftest.py | ||
| pytest.ini | ||
| requirements.txt | ||
README.md
Selenium UI Automation Project
This is a UI automation testing project based on Selenium and Pytest. It provides a basic framework for web UI testing, including page object model (POM), test case management, and test report generation.
Features
- Page Object Model (POM): Separates UI elements and business logic from test cases for better maintainability.
- Pytest Framework: A powerful testing framework for writing simple and scalable test cases.
- Allure Reports: Generates beautiful and detailed test reports.
- Automatic Screenshots: Automatically captures screenshots on test failure and attaches them to the Allure report.
- WebDriver Manager: Automatically manages the browser driver (ChromeDriver).
Tech Stack
- Language: Python 3.x
- Automation Tool: Selenium
- Testing Framework: Pytest
- Reporting: Allure
- Driver Management: webdriver-manager
Environment Setup
-
Install Python: Make sure you have Python 3.x installed. You can download it from the official Python website.
-
Install Allure: Allure is required to generate test reports. Follow the official instructions to install it on your system:
Installation and Execution
-
Clone the Repository:
git clone <repository_url> cd selenium_automation_project -
Install Dependencies: It is recommended to use a virtual environment to manage dependencies.
# Create and activate a virtual environment (optional) python -m venv venv source venv/bin/activate # On Windows, use `venv\Scripts\activate` # Install the required packages pip install -r requirements.txt -
Run Tests: You can run all tests using the following command:
pytestTo run specific tests, you can use Pytest's markers. For example, to run only the smoke tests:
pytest -m smokeFor more detailed console output during test execution, you can use the
-v(verbose) and-s(show print statements) flags:pytest -vs
Generating Test Reports
After running the tests, the Allure results will be saved in the reports/allure_results directory. You can generate the report in two ways:
1. Online Report (Temporary Preview)
This method starts a local web server to view the report. The report is temporary and will be gone once the server is stopped.
allure serve reports/allure_results
This command will automatically open the report in your default browser.
2. Offline Report (Persistent HTML)
This method generates a persistent HTML report that you can open and share.
allure generate reports/allure_results -o reports/allure_html --clean
This will create the report in the reports/allure_html directory. You can then open the index.html file in that directory to view the report.