This repository contains an automated test suite for a sample online bookstore application. The tests are written using Selenium WebDriver and TestNG in Java. The suite covers the following functionalities of the bookstore:
- Viewing a list of books.
- Viewing book details.
- Adding a book to the cart.
- Viewing the cart and updating it when a book is added.
- Proceeding to checkout from the cart.
The tests target the following website:Legenda Bookstore.
- Technology Stack
- Project Structure
- Test Scenarios
- Setup and Installation
- Running the Tests
- Dependencies
- Demo
- Programming language -
Java
- Build and project management tool -
Maven
- Testing framework -
TestNG
- Automation framework -
Selenium WebDriver
QA-online-book-store
├── drivers
│ └── chromedrivers.exe
├── src
│ └── test
│ └── java
│ └── test
│ ├── scenarios
│ │ ├── ViewListOfBooksTest.java
│ │ ├── ViewBookDetailsTest.java
│ │ ├── AddBookToCartTest.java
│ │ ├── ViewCartTest.java
│ │ └── ProceedToCheckoutTest.java
│ ├── actions
│ │ ├── ViewListOfBooks.java
│ │ ├── ViewBookDetails.java
│ │ ├── AddBookToCart.java
│ │ ├── ViewCart.java
│ │ └── ProceedToCheckout.java
│ ├── utils
│ └── └── WebDriverManager
└── pom.xml
The test suite includes the following scenarios:
- View List of Books: Verify that the list of books is displayed correctly.
- View Book Details: Verify that book details can be viewed correctly.
- Add Book to Cart: Verify that a user can add a book to the cart.
- View and Update Cart: Verify that the cart updates correctly when a book is added.
- Proceed to Checkout: Verify that the user can proceed to checkout from the cart.
To set up and run the tests, follow these steps:
-
Clone the repository:
git clone https://github.com/C6-Aseelyaser/QA-online-book-store.git cd QA-online-book-store
-
Install Maven: Ensure you have Maven installed on your system. If not, download and install it from Maven's official website.
-
Install ChromeDriver: Download and install ChromeDriver from ChromeDriver's official website. Ensure the ChromeDriver executable is in your system's PATH.
-
Update the WebDriver path: If necessary, update the path to the ChromeDriver executable in the test setup code:
System.setProperty("webdriver.chrome.driver", "/path/to/chromedriver");
-
Set up WebDriverManager (if used):
WebDriverManager.chromedriver().setup();
-
Navigate to the project directory:
cd QA-online-book-store
-
Run the tests:
- Open your IDE (e.g., IntelliJ IDEA or Eclipse).
- Navigate to the src/test/java/test/scenarios folder.
- Start with the following test files:
- ViewListOfBooksTest
- ViewBookDetailsTest
- AddBookToCartTest
- ViewCartTest
- ProceedToCheckoutTest
- Click on the file to open it.
- Press
Ctrl+Shift+F10
(or the equivalent shortcut in your IDE) to run the test.
The project has the following dependencies:
- Selenium WebDriver: For browser automation.
- TestNG: For organizing the test cases and running the tests.
- WebDriverManager: For managing browser drivers automatically.
All dependencies are specified in the pom.xml
file and will be downloaded automatically by Maven.
<dependencies>
<!-- Selenium Java Dependency -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.22.0</version>
</dependency>
<!-- TestNG Dependency -->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.9.0</version>
<scope>test</scope>
</dependency>
<!-- WebDriverManager Dependency -->
<dependency>
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<version>5.9.2</version>
</dependency>
</dependencies>