finsh commit
This commit is contained in:
82
README.md
Normal file
82
README.md
Normal file
@@ -0,0 +1,82 @@
|
||||
# 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
|
||||
|
||||
1. **Install Python**: Make sure you have Python 3.x installed. You can download it from the [official Python website](https://www.python.org/).
|
||||
|
||||
2. **Install Allure**: Allure is required to generate test reports. Follow the official instructions to install it on your system:
|
||||
- [Install Allure Commandline](https://allurereport.org/docs/gettingstarted-installation/)
|
||||
|
||||
## Installation and Execution
|
||||
|
||||
1. **Clone the Repository**:
|
||||
```bash
|
||||
git clone <repository_url>
|
||||
cd selenium_automation_project
|
||||
```
|
||||
|
||||
2. **Install Dependencies**:
|
||||
It is recommended to use a virtual environment to manage dependencies.
|
||||
```bash
|
||||
# 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
|
||||
```
|
||||
|
||||
3. **Run Tests**:
|
||||
You can run all tests using the following command:
|
||||
```bash
|
||||
pytest
|
||||
```
|
||||
To run specific tests, you can use Pytest's markers. For example, to run only the smoke tests:
|
||||
```bash
|
||||
pytest -m smoke
|
||||
```
|
||||
|
||||
For more detailed console output during test execution, you can use the `-v` (verbose) and `-s` (show print statements) flags:
|
||||
```bash
|
||||
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.
|
||||
|
||||
```bash
|
||||
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.
|
||||
|
||||
```bash
|
||||
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.
|
||||
Reference in New Issue
Block a user