This project uses Robot Framework and SeleniumLibrary to automate the testing of the Swag Labs website (https://www.saucedemo.com). The project includes the following three test scenarios:
- Customer Purchases Products: Tests that a user can add multiple products to the shopping cart and successfully complete a purchase.
- Customer Sorts Product Items: Tests that a user can sort products and verifies the sorting results.
- User Is Locked Out: Tests that a locked-out user is unable to log in and receives an appropriate error message.
- Python 3.6 or higher
- pip
-
Install Robot Framework:
pip install robotframework
-
Install SeleniumLibrary:
pip install robotframework-seleniumlibrary
-
[Optional] Install WebDriver (e.g., ChromeDriver):
- Download ChromeDriver (for Chrome versions 114 or lower)
- Add ChromeDriver to your system PATH, or note its path for later use.
├── README.md
├── data
└── test_data.robot
├── pages
└── login_page.robot
└── inventory_page.robot
└── cart_page.robot
└── checkout_page.robot
├── tests
└── swag_labs_tests.robot
data/test_data.robot: Contains the test data.pages/login_page.robot: Contains keywords for the login page.pages/inventory_page.robot: Contains keywords for the product page.pages/cart_page.robot: Contains keywords for the shopping cart page.pages/checkout_page.robot: Contains keywords for the checkout page.tests/swag_labs_tests.robot: Contains the test cases.
-
Open a terminal or command prompt.
-
Navigate to the directory containing the test case file:
cd /path/to/project/tests -
Run all test cases:
robot swag_labs_tests.robot