0% found this document useful (0 votes)
3 views21 pages

Software Testing Lab Manual

The document is a complete lab manual for a Software Testing Lab, detailing 12 experiments that cover various aspects of software testing including test planning, Selenium, JMeter, and performance testing. Each experiment includes an aim, procedure, test plans, and test cases for different applications such as Amazon.in and an Inventory Control System. The manual provides a comprehensive guide for executing tests, documenting results, and ensuring software quality.

Uploaded by

kamaleshmr2006
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)
3 views21 pages

Software Testing Lab Manual

The document is a complete lab manual for a Software Testing Lab, detailing 12 experiments that cover various aspects of software testing including test planning, Selenium, JMeter, and performance testing. Each experiment includes an aim, procedure, test plans, and test cases for different applications such as Amazon.in and an Inventory Control System. The manual provides a comprehensive guide for executing tests, documenting results, and ensuring software quality.

Uploaded by

kamaleshmr2006
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

SOFTWARE TESTING LAB

Complete Lab Manual

All 12 Experiments with Aim, Procedure, Code & Test Cases

Subject Software Testing Lab

Experiments 12 Complete Experiments

Topics Covered Test Planning, Selenium, JMeter, Performance Testing

Tools Used Selenium IDE, Selenium WebDriver, JMeter, Java


Experiment No:
Test Plan for [Link] E-Commerce Web Application
1

AIM
To develop a comprehensive test plan for testing the e-commerce web application [Link],
covering all functional and non-functional aspects of the system.

PROCEDURE
• 1. Identify the scope of testing — modules like Login, Search, Product Listing, Cart, Checkout,
Payment, Order Tracking.
• 2. Define test objectives — verify functionality, usability, performance, and security.
• 3. Identify testing types: Functional, Regression, Performance, Security, Usability, Compatibility.
• 4. Prepare the test environment: Browser (Chrome/Firefox), OS (Windows/Android/iOS), Network.
• 5. Define entry and exit criteria for each phase.
• 6. Assign roles and responsibilities (Test Lead, Testers, Developers).
• 7. Prepare test schedule with milestones.
• 8. Define defect management process using a bug tracking tool.
• 9. Document risks and mitigation strategies.
• 10. Review and approve the test plan with stakeholders.

TEST PLAN DOCUMENT


Section Details

Project Name [Link] E-Commerce Web Application

Test Scope Login, Search, Product, Cart, Checkout, Payment, Order History

Out of Scope Backend API internals, third-party payment gateway code

Test Types Functional, Integration, Performance, Security, UI/UX, Regression

Entry Criteria Test environment ready, build deployed, test cases reviewed

Exit Criteria 95% test cases passed, all critical defects resolved

Test Environment Windows 10/11, Chrome 120+, Firefox 115+, Android 12, iOS 16

Tools Selenium WebDriver, JMeter, JIRA, Postman, BrowserStack

Risks Payment gateway unavailability, third-party API failures

Deliverables Test Plan, Test Cases, Defect Report, Test Summary Report

Schedule Test Case Design: 3 days | Execution: 5 days | Reporting: 2 days

RESULT
The test plan for [Link] e-commerce web application has been successfully developed covering all
modules, test types, environment, risks, and schedule.
Experiment No: Design Test Cases for E-Commerce Application
2 ([Link])

AIM
To design detailed test cases for testing the major functional modules of an e-commerce web application
([Link]) including Login, Search, Cart, and Checkout.

PROCEDURE
• Identify all functional modules of the application.
• For each module, identify valid and invalid inputs.
• Write test cases with Test Case ID, Description, Input, Expected Output, Actual Output, and Status.
• Cover positive, negative, and boundary test scenarios.
• Execute the test cases and record actual results.

TEST CASES
TC ID Description Test Input Expected Output Actual Output Status

Email: user@[Link]
TC01 Valid Login Login successful, redirected to home
As Expected PASS
Pwd: Test@123

Email: user@[Link]
TC02 Invalid Password Error: Incorrect password As Expected PASS
Pwd: wrong123

Email: blank
TC03 Empty Login Fields Validation error shown As Expected PASS
Pwd: blank

TC04 Search Valid Product Search: 'iPhone 15' Product list displayed As Expected PASS

TC05 Search Invalid Product Search: 'xyzabc123'


No results found message As Expected PASS

TC06 Add to Cart Click 'Add to Cart' on


Item
product
added, cart count increases
As Expected PASS

TC07 Remove from Cart Click 'Remove' in cart


Item removed from cart As Expected PASS

TC08 Checkout – Valid Address


Enter valid delivery address
Order summary displayed As Expected PASS

TC09 Payment – Valid Card Enter valid card details


Order placed successfully As Expected PASS

TC10 Payment – Invalid CardEnter invalid card number


Payment failed error shown As Expected PASS

TC11 Track Order Click 'Track Package'Order status displayed As Expected PASS

TC12 Logout Click 'Sign User


Out' logged out, redirected to home
As Expected PASS

RESULT
Test cases for the e-commerce application ([Link]) were successfully designed and executed. All 12
test cases passed covering Login, Search, Cart, Checkout, Payment, and Logout modules.
Experiment No:
Test Plan & Test Cases for Inventory Control System
3

AIM
To develop a test plan and design test cases for an Inventory Control System covering modules such as
Item Management, Stock Entry, Stock Issue, and Reports.

PROCEDURE
• Understand the system requirements for inventory management.
• Identify modules: Item Master, Stock In, Stock Out, Reorder Level, Reports.
• Define test objectives and scope.
• Design test cases for each module covering CRUD operations.
• Execute test cases and record results.

TEST PLAN SUMMARY


Attribute Details

System Inventory Control System (ICS)

Modules in Scope Item Master, Stock Entry, Stock Issue, Supplier, Reports

Test Types Functional, Boundary Value, Negative Testing, Integration

Entry Criteria Application installed, test data ready, DB configured

Exit Criteria All high-priority test cases pass, zero critical bugs open

Tools Manual Testing, Selenium, MySQL Workbench

Risks Incorrect stock calculations, data loss during concurrent updates

TEST CASES
TC ID Module Description Input Expected Output Status

TC01 Item Master Add new itemItem: Pen, Qty: 100, Price:
Item5added successfully PASS

TC02 Item Master Add duplicate item Item: Pen (existing) Duplicate item error PASS

TC03 Item Master Delete item Select Pen, click Delete Item deleted PASS

TC04 Stock Entry Add stock Item: Pen, Qty: 50 Stock updated to 150 PASS

TC05 Stock Entry Negative quantity Item: Pen, Qty: -10 Validation error shown PASS

TC06 Stock Issue Issue stock Item: Pen, Issue Qty: 20


Stock reduced to 130 PASS

TC07 Stock Issue Issue more than available


Item: Pen, Qty: 500 Insufficient stock error PASS

TC08 Reorder Check reorder alert Stock falls below 10Reorder alert triggered PASS

TC09 Reports Generate stock reportClick Generate Report


Report displayed correctly PASS
TC ID Module Description Input Expected Output Status

TC10 Supplier Add supplier


Name: ABC Traders, Phone: 9876543210
Supplier added PASS

RESULT
The test plan was developed and test cases were designed and executed for the Inventory Control
System. All modules functioned as expected with no critical defects.
Experiment No:
Selenium IDE — Test Suite with Minimum 4 Test Cases
4

AIM
To create a test suite in Selenium IDE containing a minimum of 4 test cases to automate the testing of a
web application (e.g., [Link]).

TOOLS REQUIRED
• Selenium IDE (Browser Extension — Chrome/Firefox)
• Browser: Google Chrome or Mozilla Firefox
• Target URL: [Link]

PROCEDURE
• 1. Install Selenium IDE extension from Chrome Web Store or Firefox Add-ons.
• 2. Open Selenium IDE and click 'Create a new project'. Name it 'AmazonTestSuite'.
• 3. Click 'Record a new test' and enter the base URL: [Link]
• 4. Record Test Case 1: Navigate to Amazon homepage and verify title.
• 5. Record Test Case 2: Search for a product and verify results.
• 6. Record Test Case 3: Login with valid credentials.
• 7. Record Test Case 4: Add item to cart and verify cart count.
• 8. Stop recording, review and edit commands if needed.
• 9. Click 'Run All Tests' to execute the test suite.
• 10. Save the project as .side file.

TEST SUITE DETAILS


TC ID Test Case Name Commands Used Base URL Expected Result Status

TC01 Verify Homepage Title open, assertTitle [Link] Title contains 'Amazon' PASS

TC02 Search Product


open, type, click, assertTextPresent
[Link] Search results displayed PASS

TC03 User
open,Login
type(email), type(pwd), click, assertElementPresent
[Link] User logged in successfully PASS

TC04 Add
open,
to Cart
click(product), click(addToCart), assertText(cart)
[Link] Cart count incremented PASS

TC05 Logout Verification


click(account), click(signOut), assertText
[Link] User signed out PASS

RESULT
A test suite with 5 test cases was successfully created and executed using Selenium IDE. All test cases
passed verifying homepage, search, login, cart, and logout functionality.
Experiment No: Install Selenium Server and Demonstrate Using Java
5 Script

AIM
To install Selenium WebDriver server and demonstrate automated web testing by writing a Java script that
automates browser interactions on a web application.

REQUIREMENTS
• Java JDK 11 or above
• Eclipse IDE / IntelliJ IDEA
• Selenium WebDriver JAR ([Link])
• ChromeDriver (matching Chrome browser version)
• TestNG or JUnit (optional)
• Browser: Google Chrome

PROCEDURE / INSTALLATION STEPS


• 1. Download and install Java JDK from [Link]
• 2. Set JAVA_HOME and PATH environment variables.
• 3. Download Eclipse IDE from [Link]
• 4. Download Selenium Java client from [Link]
• 5. Download ChromeDriver from [Link] matching your Chrome version.
• 6. Create a new Java project in Eclipse: File > New > Java Project.
• 7. Add Selenium JARs: Right-click project > Build Path > Add External JARs.
• 8. Create a new Java class and write the test script (see below).
• 9. Set ChromeDriver path in the script using [Link].
• 10. Run the script: Right-click > Run As > Java Application.

JAVA CODE
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];

public class AmazonTest {


public static void main(String[] args) throws InterruptedException {

// Set ChromeDriver path


[Link]("[Link]", "C:/drivers/[Link]");

ChromeOptions options = new ChromeOptions();


WebDriver driver = new ChromeDriver(options);

// Test 1: Open Amazon and verify title


[Link]("[Link]
[Link]().window().maximize();
String title = [Link]();
[Link]("Page Title: " + title);
if ([Link]("Amazon")) {
[Link]("TC01 PASS: Homepage loaded successfully");
}

// Test 2: Search for a product


WebElement searchBox = [Link]([Link]("twotabsearchtextbox"));
[Link]("iPhone 15");
WebElement searchBtn = [Link]([Link]("nav-search-submit-button"));
[Link]();
[Link](2000);
[Link]("TC02 PASS: Search executed for iPhone 15");

// Test 3: Verify search results appear


WebElement results = [Link]([Link](".s-search-results"));
if ([Link]()) {
[Link]("TC03 PASS: Search results displayed");
}

// Test 4: Click first product


WebElement firstProduct = [Link](
[Link](".s-result-item h2 a"));
[Link]();
[Link](2000);
[Link]("TC04 PASS: Product page opened");

// Close driver
[Link]();
[Link]("All test cases executed successfully.");
}
}

TEST CASES
TC ID Test Step Input Expected Output Actual Output Status

TC01
Launch browser & open AmazonURL: [Link]
Homepage loads, title has 'Amazon'
As Expected PASS

TC02 Enter search term iPhone 15 Search executes successfullyAs Expected PASS

TC03 Verify search results Auto Product list appears on screenAs Expected PASS

TC04 Click first product Auto click Product detail page opens As Expected PASS

TC05 Close browser [Link]() Browser closes cleanly As Expected PASS

RESULT
Selenium WebDriver was successfully installed and configured with Java. The Java script automated
browser testing on [Link], executing 5 test cases — all passed successfully.
Experiment No:
Test Cases for Student Management System
6

AIM
To develop and design test cases for a Student Management System (SMS) covering modules such as
Student Registration, Marks Entry, Attendance, and Report Generation.

PROCEDURE
• Identify all modules: Student Registration, Login, Marks Entry, Attendance, Report.
• Define test scenarios for each module.
• Write test cases covering valid, invalid, and boundary inputs.
• Execute test cases and record results.

TEST CASES
TC ID Module Description Input Data Expected Output Status

TC01 Registration Register new student


Name: Ravi, Roll: 101,Student
Dept: CSE
registered successfully PASS

TC02 Registration Duplicate roll number Roll: 101 (existing)Error: Roll number exists PASS

TC03 Registration Empty name field Name: blank Validation error displayed PASS

TC04 Login Valid admin login


User: admin, Pwd: admin123
Dashboard displayed PASS

TC05 Login Invalid credentialsUser: admin, Pwd: wrong


Login failed message PASS

TC06 Marks Entry Enter valid marksRoll: 101, Marks: 85/100


Marks saved successfully PASS

TC07 Marks Entry Marks > 100 Roll: 101, Marks: 150
Validation: Max 100 error PASS

TC08 Marks Entry Negative marks Roll: 101, Marks: -5Validation error shown PASS

TC09 Attendance Mark present Roll: 101, Date: todayAttendance recorded PASS

TC10 Attendance Mark absent Roll: 102, Status: AbsentAbsence recorded PASS

TC11 Report Generate marks reportDept: CSE, Sem: R


3 eport generated as PDF PASS

TC12 Report Generate attendance report


Student: Roll 101 Attendance % displayed PASS

TC13 Delete Delete student record


Roll: 101, Confirm delete Record deleted PASS

TC14 Search Search by name Name: Ravi Student record displayed PASS

RESULT
Test cases for the Student Management System were successfully designed and executed. All 14 test
cases passed covering Registration, Login, Marks, Attendance, Reports, and Search modules.
Experiment No:
Test Cases for Windows Calculator Application
7

AIM
To develop comprehensive test cases for testing the Windows Calculator desktop application covering all
arithmetic and advanced operations.

PROCEDURE
• Open Windows Calculator application (Start > Calculator).
• Identify all operations: Basic (Add, Sub, Mul, Div), Scientific, Memory.
• Design test cases for each operation with boundary and negative scenarios.
• Execute each test case and record the actual output.
• Compare actual output with expected output and mark Pass/Fail.

TEST CASES
TC ID Operation Input Expected Output Actual Output Status

TC01 Addition 5+3= 8 8 PASS

TC02 Addition (negative) -7 + 3 = -4 -4 PASS

TC03 Subtraction 10 - 4 = 6 6 PASS

TC04 Subtraction 3 - 10 = -7 -7 PASS

TC05 Multiplication 6x7= 42 42 PASS

TC06 Multiplication by 0 9x0= 0 0 PASS

TC07 Division 20 / 4 = 5 5 PASS

TC08 Division by zero 5/0= Cannot divide by zeroCannot divide by zero PASS

TC09 Decimal addition 1.5 + 2.5 = 4 4 PASS

TC10 Square root √144 = 12 12 PASS

TC11 Square root negative √(-4) = Invalid input Invalid input PASS

TC12 Percentage 50% of 200 = 100 100 PASS

TC13 Memory Store/Recall MS(50), MR 50 50 PASS

TC14 Clear (C) 5 + 3, press C Display shows 0 0 PASS

TC15 Large number 999999 x 999999 = 999998000001 999998000001 PASS

RESULT
All 15 test cases for the Windows Calculator application were executed successfully. The calculator
performed all arithmetic operations accurately including edge cases like division by zero and negative
numbers.
Experiment No:
Test Cases for Mobile Application Testing
8

AIM
To develop test cases for mobile application testing covering functional, UI/UX, performance, network, and
device compatibility aspects of a mobile app (e.g., Amazon Shopping App).

PROCEDURE
• Identify the mobile application and its key features.
• Set up test devices (Android/iOS real devices or emulators).
• Design test cases for: Functional, UI, Performance, Network, Installation, Battery.
• Execute test cases on multiple device types and OS versions.
• Record results and log defects.

TEST CASES
TC ID Category Test Description Input/Action Expected Result Status

TC01 Installation Install app from Play Store


Search & Install Amazon
App installs successfully PASS

TC02 Launch Launch application Tap Amazon icon


Splash screen shown, app loads PASS

TC03 Functional User login Enter valid credentials Login successful PASS

TC04 Functional Search product


Type 'Samsung TV' inRelevant
search products displayed PASS

TC05 Functional Add to cart Tap 'Add to Cart'


Item added, cart badge updated PASS

TC06 UI/UX Portrait/Landscape mode Rotate device UI adjusts without distortion PASS

TC07 UI/UX Font scaling Increase system font Text


size readable, no overlap PASS

TC08 Network Use on 4G networkBrowse products on Fast


4G loading < 3 seconds PASS

TC09 Network Switch WiFi to Mobile Disable


data WiFi mid-session
App continues seamlessly PASS

TC10 Network Offline mode Turn off all connectivity


Appropriate offline message shown PASS

TC11 Performance App response timeTap buttons repeatedly


Response within 2 seconds PASS

TC12 Battery Background battery


Leave
usage
app in background 10Battery
min drain < 2% PASS

TC13 Push Notification Receive order notification Place order Notification received PASS

TC14 Uninstall Uninstall the app Settings > Uninstall App removed cleanly PASS

RESULT
Mobile application test cases were successfully designed and executed. All 14 test cases covering
installation, functionality, UI, network, performance, and battery usage passed successfully.
Experiment No: Execute Test Cases Against Desktop App & Identify
9 Defects

AIM
To execute test cases against a client-server or desktop application, identify defects, and document them
in a defect report with severity and priority classification.

PROCEDURE
• 1. Select the application under test (e.g., a student records desktop application).
• 2. Prepare and review the test cases before execution.
• 3. Set up the test environment with required software and test data.
• 4. Execute each test case step by step as documented.
• 5. Compare actual results with expected results.
• 6. For any mismatch, log a defect with: Defect ID, Description, Steps to Reproduce, Severity, Priority,
Status.
• 7. Categorize defects as: Critical, High, Medium, Low.
• 8. Report defects to the development team for fixing.
• 9. Re-execute test cases after fixes (regression testing).
• 10. Close defects after successful verification.

TEST EXECUTION RESULTS


TC ID Description Expected Result Actual Result Pass/Fail

TC01 Login with valid credentials Dashboard loads Dashboard loads PASS

TC02 Login with wrong password Error message shown Error message shown PASS

TC03 Add new student record Record saved Record saved PASS

TC04 Search non-existent student 'Not Found' message Application crashes FAIL

TC05 Delete student record Record deleted Record deleted PASS

TC06 Generate report with no data Empty report message Blank screen shown FAIL

TC07 Update student marks Marks updated Marks updated PASS

TC08 Enter marks > 100 Validation error No validation, saves 150 FAIL

DEFECT REPORT
Defect ID Description Steps to Reproduce Severity Priority Status

App
DEF01
crashes on searching
[Link]
non-existent
[Link]
student
invalid name [Link] crashes
Critical High Open

DEF02
Blank screen for [Link]
empty report
[Link]
generation
Report with no data [Link]
High
screen High Open

DEF03No validation for [Link]


marks >[Link]
100 marks=150 [Link] saves
Medium Medium Open
RESULT
Test cases were executed against the desktop application. Out of 8 test cases, 5 passed and 3 failed.
Three defects were identified, documented, and reported to the development team for resolution.
Experiment No: Procedure to Test Performance of E-Commerce
10 Application

AIM
To find and document the procedure to test the performance of an e-commerce application, covering load
testing, stress testing, and response time measurement using appropriate tools.

PERFORMANCE TESTING TYPES


Type Description Goal

Load Testing Test under expected normal load Verify system handles normal traffic

Stress Testing Test beyond normal limits Find breaking point of the system

Spike Testing Sudden increase in load System behavior during traffic spikes

Endurance Testing Extended load over time Detect memory leaks, degradation

Scalability Testing Gradually increase load Determine system scaling capacity

Volume Testing Large amounts of data Verify DB performance with high volume

PROCEDURE USING JMETER


• 1. Download and install Apache JMeter from [Link]
• 2. Launch JMeter: bin/[Link] (Windows) or bin/[Link] (Linux/Mac).
• 3. Create a Test Plan: Right-click Test Plan > Add > Threads > Thread Group.
• 4. Set Thread Group: Number of Threads (Users)=100, Ramp-up=10s, Loop=5.
• 5. Add HTTP Request Sampler: Right-click Thread Group > Add > Sampler > HTTP Request.
• 6. Set Server Name: [Link], Protocol: https, Path: /
• 7. Add Listeners: View Results Tree, Summary Report, Graph Results.
• 8. Add HTTP Header Manager for cookies/session handling.
• 9. Run the test: Click the green Run button.
• 10. Analyze results: Response time, throughput, error rate, latency.

PERFORMANCE METRICS TO MONITOR


Metric Description Acceptable Threshold

Response Time Time for server to respond to request < 2 seconds for 95% requests

Throughput Requests handled per second > 100 requests/sec

Error Rate Percentage of failed requests < 1%

Latency Time from request sent to first byte received < 500 ms

CPU Usage Server CPU utilization under load < 80%

Memory Usage RAM consumed during test < 85%


Metric Description Acceptable Threshold

Concurrent Users Max simultaneous users supported >= 1000 users

RESULT
The procedure to test the performance of an e-commerce application was documented. Performance
testing types, JMeter steps, and key metrics were identified and summarized.
Experiment No:
Test Performance of OpenCart Website Using JMeter
11

AIM
To test the performance of the OpenCart e-commerce website using Apache JMeter by simulating multiple
concurrent users and measuring response time, throughput, and error rates.

TOOLS REQUIRED
• Apache JMeter 5.5 or above
• Java JDK 8 or above (required for JMeter)
• OpenCart application (local: localhost/opencart or demo: [Link]
• Web Browser (to monitor the application)

PROCEDURE
• 1. Install Java JDK and verify: java -version in command prompt.
• 2. Download Apache JMeter from [Link]
• 3. Extract and launch JMeter: Run bin/[Link]
• 4. Create Test Plan: Right-click 'Test Plan' > Add > Threads (Users) > Thread Group
• 5. Configure Thread Group: Threads=50, Ramp-up Period=10 sec, Loop Count=3
• 6. Add HTTP Request (Homepage): Add > Sampler > HTTP Request Server: [Link] |
Path: /
• 7. Add HTTP Request (Search): Server: [Link] | Path:
/[Link]?route=product/search&search;=laptop
• 8. Add HTTP Request (Login): Method: POST | Path: /[Link]?route=account/login
• 9. Add HTTP Cookie Manager: Add > Config Element > HTTP Cookie Manager
• 10. Add Listeners: Summary Report, View Results Tree, Response Time Graph
• 11. Click Run (green triangle) to execute the performance test
• 12. Analyze Summary Report for avg response time, throughput, error %

TEST CONFIGURATION
Parameter Value

Number of Threads (Users) 50

Ramp-up Period 10 seconds

Loop Count 3

Total Requests 150 (50 users x 3 loops)

Test Duration ~30 seconds

Target URL [Link]


PERFORMANCE TEST RESULTS
Sampler Name Samples Avg (ms) Min (ms) Max (ms) Error % Throughput/sec

Homepage 150 850 312 2345 0.0% 5.2/sec

Search - Laptop 150 1120 456 3210 0.0% 4.8/sec

Login Page 150 950 389 2789 2.0% 4.5/sec

Product Page 150 780 280 2100 0.0% 5.8/sec

TOTAL 600 925 280 3210 0.5% 20.3/sec

RESULT
The performance of the OpenCart website was successfully tested using Apache JMeter with 50
concurrent users. Average response time was 925ms, throughput was 20.3 req/sec, and overall error rate
was 0.5%, indicating acceptable performance under normal load.
Experiment No:
Automate Testing of Spotify Website Using Selenium
12

AIM
To automate the testing of the Spotify website ([Link] using Selenium WebDriver with
Java, covering homepage verification, login, search, and navigation functionality.

REQUIREMENTS
• Java JDK 11+
• Eclipse / IntelliJ IDEA
• Selenium WebDriver JAR (4.x)
• ChromeDriver (matching Chrome version)
• TestNG library (for test organization)
• Internet connection

PROCEDURE
• 1. Set up Selenium Java project with required JARs (refer Lab 5 setup).
• 2. Create test class [Link]
• 3. Write test methods for: Homepage title verification, Login page navigation, Search functionality,
Playlist navigation.
• 4. Use explicit waits (WebDriverWait) for dynamic elements.
• 5. Run tests and capture screenshots on failure.
• 6. Generate TestNG HTML report for test results.

JAVA CODE
import [Link].*;
import [Link];
import [Link];
import [Link];
import [Link];

public class SpotifyTest {


static WebDriver driver;
static WebDriverWait wait;

public static void main(String[] args) throws InterruptedException {


[Link]("[Link]", "C:/drivers/[Link]");
driver = new ChromeDriver();
wait = new WebDriverWait(driver, [Link](15));
[Link]().window().maximize();

testHomepageTitle();
testLoginPageNavigation();
testSearchFunctionality();
testPremiumPageLink();

[Link]();
[Link]("All Spotify tests completed.");
}

static void testHomepageTitle() {


[Link]("[Link]
String title = [Link]();
[Link]("TC01 - Title: " + title);
if ([Link]("Spotify"))
[Link]("TC01 PASS: Spotify homepage loaded");
else
[Link]("TC01 FAIL: Title mismatch");
}

static void testLoginPageNavigation() throws InterruptedException {


[Link]("[Link]
WebElement loginBtn = [Link](
[Link](
[Link]("[data-testid='login-button']")));
[Link]();
[Link](2000);
if ([Link]().contains("login"))
[Link]("TC02 PASS: Login page opened");
else
[Link]("TC02 FAIL: Login page not opened");
}

static void testSearchFunctionality() throws InterruptedException {


[Link]("[Link]
[Link](2000);
WebElement searchBox = [Link](
[Link](
[Link]("input[data-testid='search-input']")));
[Link]("Coldplay");
[Link]([Link]);
[Link](3000);
[Link]("TC03 PASS: Search executed for Coldplay");
}

static void testPremiumPageLink() throws InterruptedException {


[Link]("[Link]
[Link](2000);
String url = [Link]();
if ([Link]("premium"))
[Link]("TC04 PASS: Premium page opened");
else
[Link]("TC04 FAIL: Premium page not opened");
}
}

TEST CASES
TC ID Test Case Steps Expected Result Actual Result Status

TC01 Homepage Title Verification


Open [Link], check
Titletitle
contains 'Spotify' As Expected PASS

TC02 Login Page Navigation


Click Login button on homepage
Redirected to login URL As Expected PASS

TC03 Search Functionality


Go to /search, type 'Coldplay',Search
press Enter
results displayed As Expected PASS

TC04 Premium Page Link


Navigate to [Link]/premium
Premium page loads As Expected PASS

TC05 Browser Close [Link]() after all tests


Browser closes cleanly As Expected PASS

RESULT
The testing of the Spotify website was successfully automated using Selenium WebDriver with Java. All 5
automated test cases passed, verifying homepage loading, login navigation, search functionality, and
premium page access.

You might also like