1.Develop the test plan for testing an e-commerce website/mobile application (www.amazon.
in)
Program:-
public class ECommerceTestPlan {
public static void main(String[] args) {
printTestPlan();
public static void printTestPlan() {
// Test Objectives
String[] testObjectives = {
"Verify user registration functionality",
"Test product search functionality",
"Test adding/removing items to/from the cart",
"Verify checkout and payment process",
"Test user account management"
};
// Test Scope
String testScope = "This test plan covers functional testing of the www.amazon.in e-commerce
application.";
// Test Cases
String[] testCases = {
"TC001: Verify user can register with valid information",
"TC002: Verify user cannot register with invalid information",
"TC003: Verify user can search for products and view details",
"TC004: Verify user can add items to the cart and remove them",
"TC005: Verify the checkout and payment process",
"TC006: Verify user can update their account information"
};
// Print the test plan
System.out.println("E-Commerce Test Plan");
System.out.println("-------------------");
System.out.println("Test Objectives:");
for (String objective : testObjectives) {
System.out.println("- " + objective);
System.out.println("Test Scope: " + testScope);
System.out.println("Test Cases:");
for (String testCase : testCases) {
System.out.println("- " + testCase);
OUTPUT:-
E-Commerce Test Plan
-------------------Test Objectives:
- Verify user registration functionality
- Test product search functionality
- Test adding/removing items to/from the cart
- Verify checkout and payment process
- Test user account management
Test Scope: This test plan covers functional testing of the www.amazon.in e-commerce application.
Test Cases:
- TC001: Verify user can register with valid information
- TC002: Verify user cannot register with invalid information
- TC003: Verify user can search for products and view details
- TC004: Verify user can add items to the cart and remove them
- TC005: Verify the checkout and payment process
- TC006: Verify user can update their account information
2.Design the test case for testing the e-commerce application
Program:-
import java.util.Scanner;
public class UserRegistrationTestCase {
public static void main(String[] args) {
// Initialize a Scanner for user input
Scanner scanner = new Scanner(System.in);
// Prompt the user for input
System.out.println("User Registration Test Case");
System.out.print("Enter username: ");
String username = scanner.nextLine();
System.out.print("Enter password: ");
String password = scanner.nextLine();
System.out.print("Enter email: ");
String email = scanner.nextLine();
// Close the scanner
scanner.close();
// Check if any of the input fields are empty
if (username.isEmpty() || password.isEmpty() || email.isEmpty()) {
System.out.println("Test Case: User Registration - Failed (One or more fields are empty)");
} else {
// Execute the test case
boolean registrationResult = registerUser(username, password, email);
// Check the test result
if (registrationResult) {
System.out.println("Test Case: User Registration - Passed");
} else {
System.out.println("Test Case: User Registration - Failed");
public static boolean registerUser(String username, String password, String email) {
// Simulate the user registration process
// In a real application, this would interact with the e-commerce system
// and return true if registration is successful, or false otherwise.
// For this simple example, let's assume registration is always successful.
return true;
OUTPUT:-
User Registration Test Case
Enter username: Mark antony
Enter password: Anaconda
Test Case: User Registration - Passed