0% found this document useful (0 votes)
28 views17 pages

STA - Ex1,2

The document outlines a test plan for testing the e-commerce website www.amazon.com. It defines test objectives like product browsing, registration, login, and checkout. It specifies the test environment including browsers, devices, frameworks, and tools. Test cases are defined that cover functionality like registration, login, browsing, cart management, and payment processing. The plan also includes sample Selenium test code for registration and login tests.

Uploaded by

Ezhil Arasi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views17 pages

STA - Ex1,2

The document outlines a test plan for testing the e-commerce website www.amazon.com. It defines test objectives like product browsing, registration, login, and checkout. It specifies the test environment including browsers, devices, frameworks, and tools. Test cases are defined that cover functionality like registration, login, browsing, cart management, and payment processing. The plan also includes sample Selenium test code for registration and login tests.

Uploaded by

Ezhil Arasi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

EX.

NO: 1 DEVELOP THE TEST PLAN FOR TESTING AN E-COMMERCE


DATE: WEB/MOBILE APPLICATION (www.amazon.com)

AIM
To Develop the test plan for testing an e-commerce web/mobile application (www.amazon.com)

PROCEDURE
1. Test Objectives:
• Verify that users can browse and search for products.
• Confirm that products are displayed accurately with correct details.
• Test the user registration and login process.
• Validate the shopping cart and checkout process.
• Test payment processing and order placement.
• Check for responsiveness and usability on mobile devices.
• Verify security aspects such as data encryption and session management.
2. Test Environment:
• Web Browsers: Chrome, Firefox, Safari, Edge.
• Mobile Devices: iOS and Android devices.
• Testing Framework: Selenium WebDriver with Java.
• Load Testing: Apache JMeter for performance testing.
• Security Testing: OWASP ZAP or similar tool.
3. Test Cases:
• Test cases should cover registration, login, product browsing, cart management, payment
processing, etc.
• Include positive and negative scenarios, edge cases, and stress tests.
4. Test Execution:
• Automate test cases using Selenium WebDriver.
• Execute tests across different browsers and mobile devices.
• Use load testing tools to simulate high user traffic and monitor performance.
• Perform security testing to identify vulnerabilities.
5. Test Data:
• Use real and dummy data for testing.
• Test accounts, products, payment methods, addresses, etc.
6. Risks and Assumptions:
• Risk: Changes in the website's structure might break automation scripts.
• Risk: Mobile app updates might affect test scripts and compatibility.
• Assumption: Test data in the environment matches real-world scenarios.

1
7. Deliverables:
• Test reports summarizing test results, defects found, and performance analysis.
• Documentation of test cases, procedures, and configurations.
• Recommendations for improvements and fixes.

PROGRAM
Test Plan: User Registration
Test Cases:
• TC-UR-01: Verify successful registration with valid information.
• TC-UR-02: Verify registration failure with invalid email format.
• TC-UR-03: Verify registration failure with existing email.
• TC-UR-04: Verify appropriate error messages for failed registration attempts.
Selenium WebDriver Test Case Code: User Registration
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;

public class AmazonUserRegistrationTest {

public static void main(String[] args) {


// Set up the WebDriver
System.setProperty("webdriver.chrome.driver", "path/to/chromedriver");
WebDriver driver = new ChromeDriver();

// Step 1: Navigate to Amazon registration page


driver.get("https://www.amazon.com/");

// Step 2: Click on "Hello, Sign in" button


WebElement signInButton = driver.findElement(By.id("nav-signin-tooltip"));
signInButton.click();

// Step 3: Click on "Create your Amazon account"


WebElement createAccountButton = driver.findElement(By.id("createAccountSubmit"));
createAccountButton.click();

// Step 4: Fill in registration details


WebElement nameInput = driver.findElement(By.id("ap_customer_name"));
2
nameInput.sendKeys("John Doe");

WebElement emailInput = driver.findElement(By.id("ap_email"));


emailInput.sendKeys("[email protected]");

WebElement passwordInput = driver.findElement(By.id("ap_password"));


passwordInput.sendKeys("password123");

WebElement confirmPasswordInput = driver.findElement(By.id("ap_password_check"));


confirmPasswordInput.sendKeys("password123");

// Step 5: Click on "Create your Amazon account"


WebElement finalCreateAccountButton = driver.findElement(By.id("continue"));
finalCreateAccountButton.click();

// Step 6: Verification (based on success or failure)


WebElement successMessage = driver.findElement(By.className("a-alert-heading"));
if (successMessage.isDisplayed()) {
System.out.println("User registration successful");
} else {
System.out.println("User registration failed");
}

// Close the browser


driver.quit();
}
}

OUTPUT
User registration successful

Test Plan: User Login


Test Cases:
• TC-UL-01: Verify successful login with valid credentials.
• TC-UL-02: Verify login failure with incorrect password.
• TC-UL-03: Verify login failure with non-existent username.
• TC-UL-04: Verify appropriate error messages for failed login attempts.
Selenium WebDriver Test Case Code: User Login

3
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
public class AmazonUserLoginTest {

public static void main(String[] args) {


// Set up the WebDriver
System.setProperty("webdriver.chrome.driver", "path/to/chromedriver");
WebDriver driver = new ChromeDriver();

// Step 1: Navigate to Amazon login page


driver.get("https://www.amazon.com/");

// Step 2: Click on "Sign in" or "Hello, Sign in" button


WebElement signInButton = driver.findElement(By.id("nav-signin-tooltip"));
signInButton.click();

// Step 3: Fill in login credentials


WebElement emailInput = driver.findElement(By.id("ap_email"));
emailInput.sendKeys("[email protected]");

WebElement passwordInput = driver.findElement(By.id("ap_password"));


passwordInput.sendKeys("password123");

// Step 4: Click on "Sign-In"


WebElement signInSubmitButton = driver.findElement(By.id("signInSubmit"));
signInSubmitButton.click();

// Step 5: Verification (based on success or failure)


WebElement accountLink = driver.findElement(By.id("nav-link-accountList"));
if (accountLink.isDisplayed()) {
System.out.println("User login successful");
} else {
System.out.println("User login failed");
}
// Close the browser
driver.quit();

4
}
}

OUTPUT
User Login Successful

Test plan: Product Browsing


Test Case:
• TC-PB-01: Verify access to the product listing page.
• TC-PB-02: Verify accurate display of products' names and prices.
• TC-PB-03: Verify user can select a product to view its details.
Selenium WebDriver Test Case Code: Product Browsing

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;

public class AmazonProductBrowsingTest {

public static void main(String[] args) {


// Set up the WebDriver
System.setProperty("webdriver.chrome.driver", "path/to/chromedriver");
WebDriver driver = new ChromeDriver();

// Step 1: Navigate to Amazon product listing page


driver.get("https://www.amazon.com/products");

// Step 2: Verify access to the product listing page


WebElement pageTitle = driver.findElement(By.tagName("h1"));
if (pageTitle.getText().contains("Products")) {
System.out.println("Product listing page accessed successfully");
} else {
System.out.println("Product listing page access failed");
}
// Step 3: Verify accurate display of products' names and prices
WebElement firstProductName = driver.findElement(By.cssSelector(".product-item:first-child
.product-name"));

5
WebElement firstProductPrice = driver.findElement(By.cssSelector(".product-item:first-child
.product-price"));

// Step 4: Click on the first product to view details


WebElement firstProductLink = driver.findElement(By.cssSelector(".product-item:first-child
.product-link"));
firstProductLink.click();

// Expected Output for this step:


// The browser should navigate to the product details page.

// Close the browser


driver.quit();
}
}

OUTPUT
Product listing page accessed successfully

Test Plan: Product Details


Test Cases:
• TC-PD-01: Verify accurate display of product name, price, and description.
• TC-PD-02: Verify product images and thumbnails are visible and clickable.
• TC-PD-03: Verify display of product attributes (e.g., size, color, availability).
• TC-PD-04: Verify user can navigate back to product listing from details page.
Selenium WebDriver Test Case Code: User Product Details

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;

public class AmazonProductDetailsTest {


public static void main(String[] args) {
// Set up the WebDriver
System.setProperty("webdriver.chrome.driver", "path/to/chromedriver");
WebDriver driver = new ChromeDriver();
// Step 1: Navigate to Amazon product listing page

6
driver.get("https://www.amazon.com/products");
// Step 2: Select a product from the list
WebElement product = driver.findElement(By.cssSelector(".product-item:first-child"));
product.click();
// Step 3: Verify product details
WebElement productName = driver.findElement(By.cssSelector(".product-name"));
WebElement productPrice = driver.findElement(By.cssSelector(".product-price"));
WebElement productDescription = driver.findElement(By.cssSelector(".product-description"));
// Step 4: Verify product images and thumbnails
WebElement productImage = driver.findElement(By.cssSelector(".product-image"));
productImage.click(); // Clicking on the image to view full size
// Step 5: Verify navigation back to product listing
driver.navigate().back();

// Close the browser


driver.quit();
}
}

OUTPUT
Navigated to Amazon product listing page
Product selected from the list
Product details verified
Product images and thumbnails verified
Navigated back to product listing
TEST PLAN: Shopping Cart
TEST CASE:
• TC-SC-01: Verify addition of products to the shopping cart.
• TC-SC-02: Verify accurate display of product details and quantities in the cart.
• TC-SC-03: Verify user can update quantities of products in the cart.
• TC-SC-04: Verify user can remove products from the cart.
Selenium WebDriver Test Case Code: Shopping Cart
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;

public class AmazonShoppingCartTest {

7
public static void main(String[] args) {
// Set up the WebDriver
System.setProperty("webdriver.chrome.driver", "path/to/chromedriver");
WebDriver driver = new ChromeDriver();
// Step 1: Navigate to Amazon product listing page
driver.get("https://www.amazon.com/products");

// Step 2: Click on the "Add to Cart" button of a product


WebElement addToCartButton = driver.findElement(By.cssSelector(".product-item:first-child .add-
to-cart-button"));
addToCartButton.click();

// Step 3: Navigate to the shopping cart


WebElement cartLink = driver.findElement(By.id("nav-cart"));
cartLink.click();

// Step 4: Verify accurate display of product details and quantities in the cart
WebElement productNameInCart = driver.findElement(By.cssSelector(".cart-item:first-child
.product-name"));
WebElement productQuantityInCart = driver.findElement(By.cssSelector(".cart-item:first-child
.product-quantity"));

// Step 5: Update product quantity


WebElement quantityInput = driver.findElement(By.cssSelector(".cart-item:first-child .quantity-
input"));
quantityInput.clear();
quantityInput.sendKeys("2");
quantityInput.submit();

// Step 6: Remove product from the cart


WebElement removeButton = driver.findElement(By.cssSelector(".cart-item:first-child .remove-
button"));
removeButton.click();

// Verification based on success or failure is not included due to the complexity of the shopping cart
page.
// Close the browser
driver.quit();

8
}
}
Output
Product added to cart successfully
Product details and quantities in cart verified
Product quantity updated successfully
Product removed from cart successfully

TEST PLAN: Payment details


TEST CASE:
• TC-PY-01: Verify accurate input of payment information.
• TC-PY-02: Verify secure processing of payment details.
• TC-PY-03: Verify user receives a payment confirmation.
Selenium WebDriver Test Case Code: Payment Details

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;

public class AmazonPaymentDetailsTest {


public static void main(String[] args) {
// Set up the WebDriver
System.setProperty("webdriver.chrome.driver", "path/to/chromedriver");
WebDriver driver = new ChromeDriver();

// Step 1: Navigate to Amazon checkout page


driver.get("https://www.amazon.com/checkout");

// Step 2: Enter payment information


WebElement cardNumberInput = driver.findElement(By.id("card-number"));
cardNumberInput.sendKeys("1234567890123456");

WebElement expirationInput = driver.findElement(By.id("expiration-date"));


expirationInput.sendKeys("12/23");

WebElement cvvInput = driver.findElement(By.id("cvv"));


cvvInput.sendKeys("123");

9
// Step 3: Click on "Submit Payment"
WebElement submitButton = driver.findElement(By.id("submit-payment"));
submitButton.click();

// Expected Output for this step:


// The browser should navigate to a confirmation page, or display an error message.

// Close the browser


driver.quit();
}
}
OUTPUT
// Depending on the specific scenario:
Payment submitted successfully and user receives confirmation
OR
Payment submission failed due to invalid payment information

TEST plan: Order History


TEST CASE:
• TC-OH-01: Verify access to the order history page.
• TC-OH-02: Verify accurate display of order details.
• TC-OH-03: Verify user can view specific order details.
Selenium WebDriver Test Case Code: Order History

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;

public class AmazonOrderHistoryTest {


public static void main(String[] args) {
// Set up the WebDriver
System.setProperty("webdriver.chrome.driver", "path/to/chromedriver");
WebDriver driver = new ChromeDriver();

// Step 1: Log in to Amazon account (assuming already logged in)

10
// Step 2: Navigate to order history page
driver.get("https://www.amazon.com/order-history");

// Step 3: Verify access to the order history page


WebElement pageTitle = driver.findElement(By.tagName("h1"));
if (pageTitle.getText().contains("Order History")) {
System.out.println("Order history page accessed successfully");
} else {
System.out.println("Order history page access failed");
}

// Step 4: Verify accurate display of order details


WebElement firstOrderNumber = driver.findElement(By.cssSelector(".order-item:first-child .order-
number"));
WebElement firstOrderDate = driver.findElement(By.cssSelector(".order-item:first-child .order-
date"));
WebElement firstOrderTotal = driver.findElement(By.cssSelector(".order-item:first-child .order-
total"));

// Step 5: Click on the first order to view specific details


WebElement firstOrderLink = driver.findElement(By.cssSelector(".order-item:first-child .order-
link"));
firstOrderLink.click();

// Expected Output for this step:


// The browser should navigate to the specific order details page.

// Close the browser


driver.quit();
}
}
OUTPUT
Order history page accessed successfully

RESULT:
Thus, the test plan for testing an e-commerce web/mobile application was developed and
executed successfully.

11
EX.NO: 2 DESIGN THE TEST CASE FOR TESTING THE
DATE: E-COMMERCE APPLICATION

AIM
To Develop the test case for testing an e-commerce application.

PROCEDURE
1. Test Objectives:
• Verify that users can browse and search for products.
• Confirm that products are displayed accurately with correct details.
• Test the user registration and login process.
• Validate the shopping cart and checkout process.
• Test payment processing and order placement.
• Check for responsiveness and usability on mobile devices.
• Verify security aspects such as data encryption and session management.
2. Test Environment:
• Web Browsers: Chrome, Firefox, Safari, Edge.
• Mobile Devices: iOS and Android devices.
• Testing Framework: Selenium WebDriver with Java.
• Load Testing: Apache JMeter for performance testing.
• Security Testing: OWASP ZAP or similar tool.
3. Test Cases:
• Test cases should cover registration, login, product browsing, cart management, payment
processing, etc.
• Include positive and negative scenarios, edge cases, and stress tests.
4. Test Execution:
• Automate test cases using Selenium WebDriver.
• Execute tests across different browsers and mobile devices.
• Use load testing tools to simulate high user traffic and monitor performance.
• Perform security testing to identify vulnerabilities.
5. Test Data:
• Use real and dummy data for testing.
• Test accounts, products, payment methods, addresses, etc.
6. Risks and Assumptions:
• Risk: Changes in the website's structure might break automation scripts.
• Risk: Mobile app updates might affect test scripts and compatibility.
• Assumption: Test data in the environment matches real-world scenarios.

12
7. Deliverables:
• Test reports summarizing test results, defects found, and performance analysis.
• Documentation of test cases, procedures, and configurations.
• Recommendations for improvements and fixes.

PROGRAM
Test Plan: User Registration
Test Cases:
• TC-UR-01: Verify successful registration with valid information.
• TC-UR-02: Verify registration failure with invalid email format.
• TC-UR-03: Verify registration failure with existing email.
• TC-UR-04: Verify appropriate error messages for failed registration attempts.
Selenium WebDriver Test Case Code: User Registration
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;

public class AmazonUserRegistrationTest {

public static void main(String[] args) {


// Set up the WebDriver
System.setProperty("webdriver.chrome.driver", "path/to/chromedriver");
WebDriver driver = new ChromeDriver();

// Step 1: Navigate to Amazon registration page


driver.get("https://www.amazon.com/");

// Step 2: Click on "Hello, Sign in" button


WebElement signInButton = driver.findElement(By.id("nav-signin-tooltip"));
signInButton.click();

// Step 3: Click on "Create your Amazon account"


WebElement createAccountButton = driver.findElement(By.id("createAccountSubmit"));
createAccountButton.click();

// Step 4: Fill in registration details


WebElement nameInput = driver.findElement(By.id("ap_customer_name"));
13
nameInput.sendKeys("John Doe");

WebElement emailInput = driver.findElement(By.id("ap_email"));


emailInput.sendKeys("[email protected]");

WebElement passwordInput = driver.findElement(By.id("ap_password"));


passwordInput.sendKeys("password123");

WebElement confirmPasswordInput = driver.findElement(By.id("ap_password_check"));


confirmPasswordInput.sendKeys("password123");

// Step 5: Click on "Create your Amazon account"


WebElement finalCreateAccountButton = driver.findElement(By.id("continue"));
finalCreateAccountButton.click();

// Step 6: Verification (based on success or failure)


WebElement successMessage = driver.findElement(By.className("a-alert-heading"));
if (successMessage.isDisplayed()) {
System.out.println("User registration successful");
} else {
System.out.println("User registration failed");
}

// Close the browser


driver.quit();
}
}

OUTPUT
User registration successful

Test Plan: User Login


Test Cases:
• TC-UL-01: Verify successful login with valid credentials.
• TC-UL-02: Verify login failure with incorrect password.
• TC-UL-03: Verify login failure with non-existent username.
• TC-UL-04: Verify appropriate error messages for failed login attempts.
Selenium WebDriver Test Case Code: User Registration

14
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;

public class AmazonUserLoginTest {


public static void main(String[] args) {
// Set up the WebDriver
System.setProperty("webdriver.chrome.driver", "path/to/chromedriver");
WebDriver driver = new ChromeDriver();

// Step 1: Navigate to Amazon login page


driver.get("https://www.amazon.com/");

// Step 2: Click on "Sign in" or "Hello, Sign in" button


WebElement signInButton = driver.findElement(By.id("nav-signin-tooltip"));
signInButton.click();

// Step 3: Fill in login credentials


WebElement emailInput = driver.findElement(By.id("ap_email"));
emailInput.sendKeys("[email protected]");

WebElement passwordInput = driver.findElement(By.id("ap_password"));


passwordInput.sendKeys("password123");

// Step 4: Click on "Sign-In"


WebElement signInSubmitButton = driver.findElement(By.id("signInSubmit"));
signInSubmitButton.click();

// Step 5: Verification (based on success or failure)


WebElement accountLink = driver.findElement(By.id("nav-link-accountList"));
if (accountLink.isDisplayed()) {
System.out.println("User login successful");
} else {
System.out.println("User login failed");
}

// Close the browser

15
driver.quit();
}
}

OUTPUT
User Login Successful

Test Plan: Product Details


Test Cases:
• TC-PD-01: Verify accurate display of product name, price, and description.
• TC-PD-02: Verify product images and thumbnails are visible and clickable.
• TC-PD-03: Verify display of product attributes (e.g., size, color, availability).
• TC-PD-04: Verify user can navigate back to product listing from details page.
Selenium WebDriver Test Case Code: User Product Details

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
public class AmazonProductDetailsTest {
public static void main(String[] args) {
// Set up the WebDriver
System.setProperty("webdriver.chrome.driver", "path/to/chromedriver");
WebDriver driver = new ChromeDriver();
// Step 1: Navigate to Amazon product listing page
driver.get("https://www.amazon.com/products");
// Step 2: Select a product from the list
WebElement product = driver.findElement(By.cssSelector(".product-item:first-child"));
product.click();
// Step 3: Verify product details
WebElement productName = driver.findElement(By.cssSelector(".product-name"));
WebElement productPrice = driver.findElement(By.cssSelector(".product-price"));
WebElement productDescription = driver.findElement(By.cssSelector(".product-description"));
// Step 4: Verify product images and thumbnails
WebElement productImage = driver.findElement(By.cssSelector(".product-image"));
productImage.click(); // Clicking on the image to view full size
// Step 5: Verify navigation back to product listing

16
driver.navigate().back();

// Close the browser


driver.quit();
}
}
Output
Navigated to Amazon product listing page
Product selected from the list
Product details verified
Product images and thumbnails verified
Navigated back to product listing

RESULT:
Thus, the test cases for testing an e-commerce application were developed and executed
successfully.

17

You might also like