API automation testing for DummyJSON endpoints using Python and pytest.
dummyjson-api-tests/
├── conftest.py # Shared fixtures
├── requirements.txt # Dependencies
├── auth/ # Authentication tests
│ ├── test_login_valid.py
│ ├── test_login_verify_token.py
│ ├── test_invalid_password.py
│ ├── test_invalid_username.py
│ ├── test_missing_fields.py
│ └── test_access_wrong_token.py
├── users/ # Users API tests
│ ├── test_get_all_users.py
│ ├── test_get_valid_id.py
│ ├── test_get_invalid_id.py
│ ├── test_create_new_user.py
│ ├── test_update_user.py
│ ├── test_delete_user.py
│ ├── test_get_user_pagination.py
│ └── test_search_user.py
└── products/ # Products API tests
├── test_get_products_list.py
├── test_get_product_by_id.py
├── test_get_product_invalid_id.py
├── test_search_product.py
├── test_filter_category.py
├── test_add_product.py
├── test_update_product.py
├── test_delete_product.py
└── test_product_pagination_and_limit.py
- Clone the repository
git clone https://github.com/Veloruze/dummyjson-api-tests.git
cd dummyjson-api-tests- Create virtual environment (optional)
python -m venv venv
venv\Scripts\activate # Windows
source venv/bin/activate # Linux/Mac- Install dependencies
pip install -r requirements.txtRun all tests:
pytestRun specific folder:
pytest auth/
pytest users/
pytest products/Run single test file:
pytest auth/test_login_valid.pyRun with verbose output:
pytest -vRun with timeout (recommended):
pip install pytest-timeout
pytest --timeout=15| Module | Endpoint | Tests |
|---|---|---|
| Auth | POST /auth/login | Valid login, invalid password, invalid username, missing fields |
| Auth | GET /auth/me | Verify token, wrong token |
| Users | GET /users | Get all, pagination, search |
| Users | GET /users/:id | Valid ID, invalid ID |
| Users | POST /users/add | Create new user |
| Users | PUT /users/:id | Update user |
| Users | DELETE /users/:id | Delete user |
| Products | GET /products | Get all, pagination, search, filter by category |
| Products | GET /products/:id | Valid ID, invalid ID |
| Products | POST /products/add | Add product |
| Products | PUT /products/:id | Update product |
| Products | DELETE /products/:id | Delete product |
- Python 3.x
- pytest
- requests