Skip to content

Commit 71c5d34

Browse files
committed
♻️ Standardize on .venv:
- Remove extra venv directory - Update README with clear venv instructions - Add warnings about using correct venv - Document virtual environment setup - Clarify development workflow - Add tips for dependency management This change ensures consistent test execution by standardizing on .venv as the only virtual environment.
1 parent 93e352c commit 71c5d34

1 file changed

Lines changed: 50 additions & 128 deletions

File tree

README.md

Lines changed: 50 additions & 128 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
`# 🧪 API Test Automation Framework
1+
# 🧪 API Test Automation Framework
22

33
A professional API testing framework built using **Python**, **Pytest**, and **Allure** for reporting.
44
This framework is designed to test RESTful APIs using data-driven and contract-based testing approaches.
@@ -17,6 +17,7 @@ Target API: [ReqRes Public API](https://reqres.in/)
1717
- Allure report integration
1818
- Pytest markers and logging
1919
- Compatible with CI/CD (via GitHub Actions)
20+
- Isolated virtual environment in `.venv`
2021

2122
---
2223

@@ -91,130 +92,51 @@ pip install -r requirements.txt
9192

9293
---
9394

94-
## 🧪 Running Tests
95-
96-
### Quick Start
97-
```bash
98-
# Run all tests
99-
./test_runner.sh all
100-
101-
# Run smoke tests (quick validation)
102-
./test_runner.sh smoke
103-
104-
# Run specific test categories
105-
./test_runner.sh regression
106-
./test_runner.sh negative
107-
```
108-
109-
### Test Categories Available
110-
111-
| Category | Description | Command |
112-
|----------|-------------|---------|
113-
| 🚀 **smoke** | Core functionality validation | `./test_runner.sh smoke` |
114-
| 🔄 **regression** | Comprehensive testing | `./test_runner.sh regression` |
115-
|**negative** | Error scenarios & edge cases | `./test_runner.sh negative` |
116-
| 🔍 **boundary** | Boundary testing (large payloads) | `./test_runner.sh boundary` |
117-
| 📋 **contract** | API schema validation | `./test_runner.sh contract` |
118-
|**performance** | Response time validation | `./test_runner.sh performance` |
119-
|**retrieval** | User GET operations | `./test_runner.sh retrieval` |
120-
|**creation** | User POST operations | `./test_runner.sh creation` |
121-
122-
### Direct pytest Commands
123-
```bash
124-
# Run specific test file
125-
pytest tests/test_user_retrieval.py -v
126-
127-
# Run tests with specific markers
128-
pytest -m "smoke" -v
129-
pytest -m "user_creation and not boundary" -v
130-
131-
# Run all tests with detailed output
132-
pytest -v --tb=short
133-
```
134-
135-
136-
---
137-
138-
---
139-
140-
## 📊 Generate Allure Report
141-
142-
```bash
143-
# Generate and view HTML report
144-
allure generate reports/allure-results -o reports/html --clean
145-
allure open reports/html
146-
147-
# Or serve live report
148-
allure serve reports/allure-results
149-
```
150-
151-
---
152-
153-
## 🚦 Test Organization
154-
155-
### Test Modules
156-
157-
| Module | Purpose | Key Features |
158-
|--------|---------|--------------|
159-
| `test_user_retrieval.py` | GET operations | User listing, single user, pagination |
160-
| `test_user_creation.py` | POST operations | Data-driven creation, boundary testing |
161-
| `test_error_scenarios.py` | Error handling | 404s, invalid data, malformed requests |
162-
| `test_api_validation.py` | Contract testing | Schema validation, headers, performance |
163-
164-
### Pytest Markers
165-
166-
The framework uses comprehensive pytest markers for test categorization:
167-
168-
```bash
169-
# Execution-based markers
170-
@pytest.mark.smoke # Quick validation tests
171-
@pytest.mark.regression # Comprehensive test suite
172-
@pytest.mark.negative # Error scenario tests
173-
@pytest.mark.boundary # Edge case and boundary tests
174-
175-
# Feature-based markers
176-
@pytest.mark.user_retrieval # GET user operations
177-
@pytest.mark.user_creation # POST user operations
178-
@pytest.mark.error_scenarios # Error handling tests
179-
@pytest.mark.api_validation # Contract and validation tests
180-
181-
# Quality markers
182-
@pytest.mark.contract # API schema validation
183-
@pytest.mark.performance # Response time validation
184-
```
185-
186-
### Running Specific Test Categories
187-
```bash
188-
# Run only smoke tests
189-
pytest -m smoke
190-
191-
# Run user creation tests
192-
pytest -m user_creation
193-
194-
# Combine markers
195-
pytest -m "smoke and user_retrieval"
196-
197-
# Exclude certain tests
198-
pytest -m "not boundary"
199-
```
200-
201-
202-
---
203-
204-
🛠 Troubleshooting
205-
206-
See troubleshooting_log.md for common errors and fixes (e.g., Chrome driver, Allure, virtualenv).
207-
208-
209-
---
210-
211-
🤝 Contributing
212-
213-
Pull requests are welcome. Please open an issue first to discuss changes.
214-
215-
216-
---
217-
218-
📄 License
219-
220-
This project is licensed under the MIT License.
95+
## 🚀 Quick Start
96+
97+
1. Clone the repository:
98+
```bash
99+
git clone https://github.com/your-username/API-Test-Automation-Framework.git
100+
cd API-Test-Automation-Framework
101+
```
102+
103+
2. Run the setup script (creates `.venv` and installs dependencies):
104+
```bash
105+
./setup.sh
106+
```
107+
108+
3. Activate the virtual environment:
109+
```bash
110+
source .venv/bin/activate # On Unix/macOS
111+
# or
112+
.venv\Scripts\activate # On Windows
113+
```
114+
115+
4. Run the tests:
116+
```bash
117+
pytest tests/ -v # Run all tests
118+
pytest tests/ -m smoke # Run smoke tests only
119+
```
120+
121+
⚠️ Important: Always use the `.venv` virtual environment. This is the standard environment used by our CI/CD workflow and ensures consistent test execution across all environments.
122+
123+
## 🛠️ Development Setup
124+
125+
1. Ensure you're using the correct virtual environment:
126+
```bash
127+
# You should see (.venv) in your prompt
128+
# If not, activate it:
129+
source .venv/bin/activate
130+
```
131+
132+
2. Verify your setup:
133+
```bash
134+
python --version # Should match version in .github/workflows/ci.yml
135+
pip list # Should match requirements.txt
136+
```
137+
138+
3. Install new dependencies:
139+
```bash
140+
pip install new-package
141+
pip freeze > requirements.txt # Update requirements
142+
```

0 commit comments

Comments
 (0)