|
1 | | -# Automated-testing-project |
2 | | -A beginner-friendly test automation project for web apps using Selenium and Pytest. It features simple, maintainable test scripts and GitHub Actions for CI/CD. Explore my Python and QA skills! |
3 | | -# Automated Web Testing Framework with Selenium and Pytest |
4 | | - |
5 | | -A beginner-friendly QA automation project demonstrating end-to-end (E2E) testing for the SauceDemo e-commerce demo app (https://www.saucedemo.com/). This framework uses the Page Object Model (POM) for maintainable tests, covering login scenarios (successful and error cases) and inventory/cart flows. Built with Python, Selenium, and Pytest for modular, scalable testing. |
| 1 | +Automated Web Testing Framework with Selenium and PytestA beginner-friendly QA automation project demonstrating end-to-end (E2E) testing for the SauceDemo e-commerce demo app (https://www.saucedemo.com/). This framework uses the Page Object Model (POM) for maintainable tests, covering login scenarios (successful and error cases), inventory management (add/sort), cart operations (add/remove/verify), and full checkout flows. Built with Python, Selenium, and Pytest for modular, scalable testing. Includes data-driven tests, cross-browser support (Firefox/Chrome), and advanced reporting. |
6 | 2 |
|
7 | 3 | [](https://www.python.org/) |
8 | 4 | [](https://www.selenium.dev/) |
9 | 5 | [](https://pytest.org/) |
10 | 6 |
|
11 | 7 | ## Overview |
12 | | -- **Goal**: Automate key user flows like user authentication, adding items to cart, and verifying cart contents. |
13 | | -- **App Under Test**: SauceDemo – a sample e-commerce site for testing login, inventory, and checkout. |
14 | | -- **Current Coverage**: 5 tests (4 login variants + 1 add-to-cart with cart verification). |
15 | | -- **Run Environment**: Firefox headless via WebDriver Manager (no manual driver setup needed). |
| 8 | +Goal: Automate key user flows like authentication, product sorting/adding to cart, item management, and complete checkout processes. |
| 9 | +App Under Test: SauceDemo – a sample e-commerce site for testing login, inventory, cart, and checkout. |
| 10 | +Current Coverage: 12+ tests (4 login variants, 4 inventory flows, 4 cart/E2E checkouts) with data-driven parametrization and ~90% pass rate. |
| 11 | +Run Environment: Firefox/Chrome (headless for CI; non-headless for local debugging) via WebDriver Manager (no manual driver setup needed). |
| 12 | +Scalability: Easy to extend with more browsers, APIs, or mobile emulation. |
| 13 | + |
16 | 14 |
|
17 | 15 | ## Tech Stack |
18 | | -- **Languages/Tools**: Python 3.9+, Selenium WebDriver, Pytest, Pytest-HTML (for reports). |
19 | | -- **Design Pattern**: Page Object Model (POM) for clean separation of page elements and actions. |
20 | | -- **Config**: Credentials managed in a separate config file for security. |
21 | | -- **Browser**: Firefox (headless mode for CI-friendly runs). |
| 16 | +Languages/Tools: Python 3.9+, Selenium WebDriver, Pytest, WebDriver Manager. |
| 17 | +Reporting: Pytest-HTML (basic logs) + Allure (interactive dashboards with steps, timelines, and screenshots). |
| 18 | +Design Pattern: Page Object Model (POM) for clean separation of locators, actions, and config. |
| 19 | +CI/CD: GitHub Actions for automated runs on push/PR, with report artifacts. |
| 20 | +Other: Data-driven testing via @pytest.mark.parametrize, explicit waits for stability. |
22 | 21 |
|
23 | | -## Project Structure |
24 | | -Automated-testing-project/ |
| 22 | +automated-testing-project/ |
25 | 23 | ├── config/ |
26 | | -│ └── config_for_login_page.py # Test credentials (standard_user, locked_out, etc.) |
| 24 | +│ ├── config_for_login_page.py # Test credentials (standard_user, locked_out, invalid, empty) |
| 25 | +│ ├── config_for_inventory_page.py # Product locators and details (add/remove selectors) |
| 26 | +│ └── config_for_cart_page.py # Cart product mappings (display names, actions) |
27 | 27 | ├── pages/ |
28 | | -│ ├── login_page.py # Login page actions (open, enter creds, logout) |
29 | | -│ ├── inventory_page.py # Inventory actions (add to cart, badge count) |
30 | | -│ └── cart_page.py # Cart verification (get items, checkout button) |
| 28 | +│ ├── login_page.py # Login actions (open, enter creds, error handling, logout) |
| 29 | +│ ├── inventory_page.py # Inventory actions (add single/multi, sort by price, badge count, go to cart) |
| 30 | +│ ├── cart_page.py # Cart verification (get items, remove, badge, start checkout) |
| 31 | +│ └── checkout_page.py # Checkout steps (fill info, continue, complete) |
31 | 32 | ├── tests/ |
32 | 33 | │ ├── test_login.py # Login tests (success, errors) |
33 | | -│ └── test_inventory.py # Inventory and cart tests |
| 34 | +│ ├── test_inventory.py # Inventory tests (add, multi-add, sort, prices) |
| 35 | +│ └── test_cart.py # Cart and E2E tests (verify, remove, checkout) |
34 | 36 | ├── reports/ # Generated HTML reports (run pytest to create) |
| 37 | +├── allure-results/ # Raw Allure data (auto-generated) |
| 38 | +├── allure-report/ # Generated Allure HTML dashboard |
35 | 39 | ├── docs/ # Screenshots and docs (e.g., report_screenshot.png) |
36 | | -├── requirements.txt # Dependencies |
| 40 | +├── requirements.txt # Dependencies (selenium, pytest, allure-pytest, etc.) |
| 41 | +├── .github/workflows/ci.yml # GitHub Actions for CI/CD |
37 | 42 | └── README.md # You're reading it! |
| 43 | +Quick StartClone the Repo: |
| 44 | + |
| 45 | +git clone https://github.com/your-username/automated-testing-project.git |
| 46 | +cd automated-testing-project |
| 47 | + |
| 48 | +Install Dependencies: |
| 49 | + |
| 50 | +pip install -r requirements.txt |
| 51 | + |
| 52 | +Run Tests:All tests: pytest tests/ -v |
| 53 | +With HTML report: pytest tests/ --html=reports/report.html --self-contained-html -v |
| 54 | +With Allure: pytest tests/ --alluredir=allure-results -v then allure serve allure-results |
| 55 | +Specific test: pytest tests/test_cart.py::test_full_e2e_checkout -v |
| 56 | +Cross-browser (if marked): pytest -m cross_browser -v |
| 57 | + |
| 58 | +View Reports:HTML: Open reports/report.html in your browser for logs and pass/fail summaries. |
| 59 | +HTML Report Example |
| 60 | +Allure: Run allure serve allure-results for an interactive dashboard (timelines, steps, attachments). Example screenshot: |
| 61 | +Allure Dashboard |
| 62 | +Tests CoveredLogin (test_login.py): Successful login, locked-out user, invalid credentials, empty username (4 tests). |
| 63 | +Inventory (test_inventory.py): Add single product to cart, multi-add products, sort by price (lo-hi/hi-lo), validate prices (4 tests). |
| 64 | +Cart & E2E (test_cart.py): Verify cart items/badge, remove single/all items, start checkout, full E2E checkout (parametrized with user data) (4+ tests). |
| 65 | + |
| 66 | +All tests include asserts for URLs, elements, text, and edge cases. Data-driven for efficiency (e.g., multiple products/usernames). |
| 67 | + |
| 68 | +CI/CD IntegrationGitHub Actions runs tests on every push/PR to main. |
| 69 | +Artifacts: Download allure-report or html-report from Actions tab for post-run analysis. |
| 70 | +Badges update automatically for build status. |
| 71 | + |
| 72 | +Contributing & Next StepsFork, PRs welcome! Add more tests (e.g., responsive checks) or browsers. |
| 73 | +For production: Integrate coverage (pytest-cov) or parallel runs (pytest-xdist). |
| 74 | +Questions? Open an issue. |
38 | 75 |
|
| 76 | + |
| 77 | + |
| 78 | +Built by Jerry Finol | Last Updated: September 29, 2025 |
39 | 79 |
|
0 commit comments