Software Testing Final Lab Print
Software Testing Final Lab Print
CCS366
Register No :
Branch/Sem : CSE / V
B.E. - III YEAR / V SEMESTER
External Examiner:
Vision of Institution
To build Jeppiaar Engineering College as an Institution of Academic Excellence in Technicaleducation
and Management education and to become a World Class University.
Mission of Institution
M1 To excel in teaching and learning, research and innovation by promoting the
principles of scientific analysis and creative thinking
M3 To equip students with values, ethics and life skills needed to enrich their lives and
enable them to meaningfully contribute to the progress of society
M4 To prepare students for higher studies and lifelong learning, enrich them with the
practical and entrepreneurial skills necessary to excel as future professionals and
contribute to Nation’s economy
Vision of Department
To emerge as a globally prominent department, developing ethical computer
professionals,innovators and entrepreneurs with academic excellence through quality education and
research.
Mission of Department
PEO1 To address the real time complex engineering problems using innovative approach
with strong core computing skills.
PEO3 Apply ethical knowledge for professional excellence and leadership for the
betterment of the society.
PEO4 Develop life-long learning skills needed for better employment and
entrepreneurship
An ability to understand the core concepts of computer science and engineering and to enrich
PSO1 problem solving skills to analyze, design and implement software and hardware based systems
of varying complexity.
To interpret real-time problems with analytical skills and to arrive at cost effective and
PSO2 optimal solution using advanced tools and techniques.
CO1 Understand the basic concepts of software testing and the need for software testing
CO2 Design Test planning and different activities involved in test planning
CO3 Design effective test cases that can uncover critical defects in the application
1
Develop the test plan for testing an e-commerce
web/mobile application ([Link]).
2
Design the test cases for testing the e-commerce
application
3
Test the e-commerce application and report the
defects in it
4 Develop the test plan and design the test cases for
an inventory control system
9A MINI PROJECT
Data-Driven Framework Using Selenium and
TestNG
AIM
To develop test plan document for testing e-commerce or banking web and mobile application
1) INTRODUCTION
The Test Plan is designed to prescribe the scope, approach, resources, and schedule of all testing
activities of the project Jeppiaar Bank.
The plan identify the items to be tested, the features to be tested, the types of testing to be
performed, the personnel responsible for testing, the resources and schedule required to complete
testing, and the risks associated with the plan
1.1) Scope
1.1.1) In Scope
All the feature of websiteJeppiaar Bank which were defined in software requirement specs are
need to be tested
1
1.1.2) Out of Scope
These feature are not be tested because they are not included in the software requirement specs
• User Interfaces
• Hardware Interfaces
• Software Interfaces
• Database logical
• Communications Interfaces
• Website Security and Performance
The test objectives are to verify the Functionality of website Jeppiaar Bank, the project should
focus on testing the banking operation such as Account Management, Withdrawal, and
Balance…etc. to guarantee all these operation can work normally in real business environment.
The project should use outsource members as the tester to save the project cost.
2
2 TEST METHODOLOGY
2.1 Overview
• Integration Testing (Individual software modules are combined and tested as a group)
• System Testing: Conducted on a complete, integrated system to evaluate the system’s
compliance with its specified requirements
• /[Link]: Test all the APIs create for the software under tested
If the team members report that there are 40% of test cases failed, suspend testing until the
development team fixes all the failed cases.
3 TEST DELIVERABLES
3
• Before testing phase
• Test plans document.
• Test cases documents
• Test Design specifications.
• During the testing
– Test Tool Simulators.
– Test Data
It mentions the minimum hardware and software requirements that will be used to test the Application.
RESULT:
Test plan document for testing e-commerce or banking web and mobile application was created
4
[Link].2 CREATE TEST CASES FOR TESTING E-COMMERCE OR ANY
AIM
1. To develop test cases for testing e-commerce or any web and mobile application
5
Test Scenario – Purchase
6
Test Scenario – Search
RESULT:
Test cases for testing e-commerce or any web and mobile application was developed
7
[Link].3 TEST THE E-COMMERCE APPLICATION AND REPORT THE
Date: DEFECTS IN IT
AIM
To Design Front-end for any web application and derive the test cases as applicable. Validate the
UI elements using JavaScript.
PROGRAM
1. HTML
<html>
<head>
<title>Javascript Login Form Validation</title>
<!-- Include CSS File Here -->
<link rel="stylesheet" href="[Link]"/>
<!-- Include JS File Here -->
<script src="[Link]"></script>
</head>
<body>
<div class="container">
<div class="main">
<h2>Javascript Login Form Validation</h2>
<form id="form_id" method="post" name="myform">
<label>User Name :</label>
<input type="text" name="username" id="username"/>
<label>Password :</label>
<input type="password" name="password" id="password"/>
<input type="button" value="Login" id="submit" onclick="validate()"/>
</form>
<span><b class="note">Note : </b>For this demo use following username and password.
<br/><b class="valid">User Name : Form<br/>Password : 123</b></span>
8
</div>
</div>
</body>
</html>
2. [Link]:
3. [Link]
<html>
<head>
<title>Javascript Login Form Validation</title>
</head>
<body>
<h2>Successful Login!</h2>
</body>
</html>
9
OUTPUT
Logged in successfully.
10
Program:
class EcommerceApp:
def _init_(self):
# Initialize the application and user data
[Link] = {}
return False
def test_login():
app = EcommerceApp()
11
if result:
print("Test Case 1: Valid User Login - Passed")
else:
print("Test Case 1: Valid User Login - Failed")
if _name_ == "_main_":
print("Running E-commerce Application Tests")
test_login()
Output:
Result:
Thus, the above programs to test the e-commerce application and report the defects in it has been
executed successfully.
12
[Link].4 DEVELOP A TEST PLAN AND DESIGN THE TEST CASES FOR THE
INVENTORY CONTROL SYSTEM
Date:
AIM:
To develop a test plan and design the test cases for the inventory control system .
ALGORITHM :
STEP 4 : Design Test Cases: Create detailed test cases for each identified scenario, specifying
preconditions, steps, and expected outcomes.
STEP 5: Execute Test Cases: Execute the test cases using the prepared data .
STEP 6:Analyze Results: Evaluate test results to identify defects, issues, and areas for improvement.
STEP 7: Report and Retest: Document and report any identified defects, and then retest once the
issues are resolved.
Objective: To ensure the functionality, reliability, and accuracy of the inventory control system.
2. Test Scope
3. Test Objectives
4. Test Environment
5. Test Strategy
13
Explain the overall approach to testing, including manual vs. automated testing, regression testing, and
exploratory testing.
6. Test Schedule
7. Test Deliverables
List the documents and artifacts to be produced during testing (e.g., test cases, test reports).
8. Test Cases
9. Defect Management
Identify potential risks to the testing process and provide contingency plans.
Objective:
The item should be added to the inventory, and the quantity should be updated accordingly.
Objective:
14
Expected Result:
Objective:
Expected Result:
The inventory report should accurately reflect the current state of the inventory.
Objective:
To ensure that stock alerts are generated when inventory falls below a certain threshold.
A stock alert should be generated for items with quantities below the threshold.
Test Case 5: User Permissions
Objective:
Expected Result:
RESULT
Thus, the above program to develop the test plan and design the test cases for an inventory control
system was implemented and executed successfully.
15
[Link].5 EXECUTE THE TEST CASES AGAINST A CLIENT SERVER OR
DESKTOP APPLICATION AND IDENTIFY THE DEFECTS.
Date:
AIM:
To execute the test cases against a client server or desktop application and
identify the defects.
ALGORITHM :
STEP 2: First prepare the test cases for checking the client server program .
STEP 3: Configure the test environment with client and server settings.
STEP 4: Execute the test cases for the client and the server program .
STEP 5: Report the defects that occur during the testing process .
STEP 8: Maintain the documentation of the test cases , test results and the defects .
16
PROGRAM :
SERVER SIDE :
[Link](); [Link]();
17
CLIENT SIDE :
import [Link].*; import [Link].*;
public class Client { public static void
main(String[] args) throws IOException {
[Link](message);
18
OUTPUT :
• Some security issues like SQL injection and Cross Site Scripting may occur .
import requests
return response
if response.status_code == 200:
print("Test Case 1: User Registration - Passed")
else:
print("Test Case 1: User Registration - Failed")
def test_case_2():
# Test Case: Verify user login
endpoint = "login"
data = {"username": "testuser", "password": "testpassword"}
response = send_request(endpoint, method="POST", data=data)
if response.status_code == 200:
print("Test Case 2: User Login - Passed")
else:
print("Test Case 2: User Login - Failed")
def test_case_3():
# Test Case: Verify product retrieval
endpoint = "products"
response = send_request(endpoint)
20
if response.status_code == 200:
print("Test Case 3: Product Retrieval - Passed")
else:
print("Test Case 3: Product Retrieval - Failed")
Output:
Executing Test Cases for Client-Server Application
RESULT :
Thus the execution of the test cases against a client server or desktop application is successfully
executed.
21
[Link].6 TEST THE PERFORMANCE OF THE E-COMMERCE
APPLICATION
Date:
AIM:
To write a java programs for test the performance of the e-commerce application.
ALGORITHM:
1. Set the JMeter home path to specify the directory where JMeter is installed.
2. Initialize JMeter by loading the JMeter properties and setting the locale.
3. Create a test plan for the performance testing of the e-commerce application.
5. Configure the thread group with the desired number of threads and ramp-up time.
6. Create an HTTP sampler to specify the URL and method for accessing the e-commerce
application.
7. Construct the test plan tree by adding the initialized elements to the test plan.
8. Configure and run the JMeter test by setting up the JMeter engine and executing the test
plan tree.
PROGRAM:
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
22
// Set JMeter home path
[Link]("/path/to/your/apache-jmeter-directory");
// Initialize JMeter
[Link]([Link]() +
"/bin/[Link]");
[Link]();
[Link](10);
[Link](1);
[Link](new LoopController());
[Link]("[Link]");
[Link]("/");
[Link]("GET");
[Link](testPlan);
[Link](threadGroup, testPlan);
[Link](httpSampler, threadGroup);
[Link](testPlanTree);
23
[Link]();
OUTPUT:
summary:
- Number of threads: 10
RESULT:
Thus the above java program to test the performance of the e-commerce application
24
[Link].7 TESTING OF E-COMMERCE APPLICATION USING SELENIUM
Date:
AIM:
To write a java program for automate the testing of e-commerce applications using
Selenium.
ALGORITHM:
4. Find and interact with different elements on the web page using Selenium commands.
5. Perform specific testing actions, such as clicking on buttons and filling in form fields.
PROGRAM:
import [Link];
import [Link];
import [Link];
[Link]("[Link]", "/path/to/chromedriver");
// Initialize ChromeDriver
25
// Open the e-commerce application
[Link]("[Link]
// Example actions:
[Link]([Link]("loginButton")).click();
[Link]([Link]("username")).sendKeys("testuser");
[Link]([Link]("password")).sendKeys("password123");
[Link]([Link]("loginForm")).submit();
[Link]();
OUTPUT:
Started ChromeDriver
26
[Date & Time] [INFO]: [e-commerce_application_url] opened successfully.
[Date & Time] [INFO]: Filled in the login form with the username and password.
RESULT:
Thus the above java programs automate the testing of e-commerce applications using
Selenium.
27
EX NO: 8
Integrate TestNG with Test Automation
DATE:
AIM:
To write a java program for integrate TestNG with the above test automation.
ALGORITHM:
5. Use TestNG annotations to mark the test method and define the test steps.
6. Perform specific testing actions, such as clicking on buttons and filling in form fields.
7. Define the teardown method to run after the test class to close the browser.
8. Output the test results provided by TestNG, including the number of tests run, passed, failed,
and skipped.
PROGRAM:
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
WebDriver driver;
@BeforeClass
28
public void setUp() {
[Link]("[Link]", "/path/to/chromedriver");
@Test
[Link]("[Link]
[Link]([Link]("loginButton")).click();
[Link]([Link]("username")).sendKeys("testuser");
[Link]([Link]("password")).sendKeys("password123");
[Link]([Link]("loginForm")).submit();
@AfterClass
if (driver != null) {
[Link]();
OUTPUT:
[TestNG] Running:
/path/to/your/test/[Link]
Starting ChromeDriver
29
[Date & Time] [INFO]: Starting ChromeDriver [version_number] on port [port_number]
[Date & Time] [INFO]: Filled in the login form with the username and password.
[TestNG] Results:
RESULT:
Thus the above java program for integrate TestNG with the above test automation.
30
EX NO: 9 A) MINI PROJECT
AIM:
To write java program for build a data-driven framework using Selenium and TestNG.
ALGORITHM:
1. Define the test data provider method using the `@DataProvider` annotation to supply data to
the test method.
9. Output the test results provided by TestNG, including the number of tests run, passed, failed,
and skipped.
PROGRAM:
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
31
WebDriver driver;
@Test(dataProvider = "loginData")
[Link]("[Link]", "/path/to/chromedriver");
[Link]("[Link]
[Link](username);
[Link](password);
[Link]();
[Link]();
@DataProvider(name = "loginData")
OUTPUT:
[TestNG] Running:
/path/to/your/test/[Link]
Starting ChromeDriver
32
[Date & Time] [INFO]: Starting ChromeDriver [version_number] on port [port_number]
[TestNG] Results:
RESULT:
Thus the above java program for build a data-driven framework using Selenium and
TestNG.
33
EX NO: 9 B) MINI PROJECT
AIM:
To Using Selenium and TestNG to implement the Page Object Model for efficient and
maintainable automated testing in Java.
ALGORITHM:
1. Define the page object class, LoginPage, to encapsulate the login functionality, including
the web elements and related methods.
2. Annotate the setup method with @BeforeMethod to initialize the ChromeDriver before
each test method.
3. Annotate the teardown method with @AfterMethod to close the web browser after each
test method.
4. Annotate the test method with @Test to execute the test scenario for the login
functionality.
5. Instantiate the LoginPage class within the test method to access the login functionality.
6. Use the Selenium WebDriver to interact with the web elements and perform the login
action.
7. Output the test results provided by TestNG, including the number of tests run, passed,
failed, and skipped.
PROGRAM:
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
34
import [Link];
WebDriver driver;
By usernameLocator = [Link]("username");
By passwordLocator = [Link]("password");
By loginButtonLocator = [Link]("loginButton");
@BeforeMethod
[Link]("[Link]", "/path/to/chromedriver");
@Test
[Link]("[Link]
[Link]("testuser", "password123");
@AfterMethod
if (driver != null) {
[Link]();
35
}
[Link] = driver;
[Link](username);
[Link](password);
[Link]();
OUTPUT:
[TestNG] Running:
/path/to/your/test/[Link]
Starting ChromeDriver
36
[Date & Time] [INFO]: Please see [Link]
for suggestions on keeping ChromeDriver safe.
[TestNG] Results:
RESULT:
Thus the java program using Selenium and TestNG to implement the Page Object Model
for efficient and maintainable automated test is completed successfully.
37
EX NO: 9 C)
Build BDD framework with Selenium, TestNG and Cucumber
DATE:
AIM:
To write a java program for build BDD framework with Selenium, TestNG and
Cucumber.
ALGORITHM:
2. Define step definitions using the Cucumber annotations (@Given, @When, @Then,
@And) to represent the Given, When, Then, and And steps in BDD.
4. Execute the "open the browser" step, which launches the Chrome browser.
5. Execute the "navigate to the e-commerce website" step, which navigates to the specified
e-commerce website.
6. Execute the "verify the title of the page" step, which verifies the title of the webpage
using Selenium's getTitle method and TestNG's assertion.
7. Execute the "close the browser" step, which closes the browser session.
8. Output the test results provided by TestNG, including the number of tests run, passed,
failed, and skipped.
PROGRAM:
import [Link];
import [Link];
WebDriver driver;
38
[Link]("[Link]", "/path/to/chromedriver");
[Link]("[Link]
[Link](actualTitle, expectedTitle);
if (driver != null) {
[Link]();
OUTPUT:
[TestNG] Running:
/path/to/your/test/[Link]
39
Starting ChromeDriver
[Date & Time] [INFO]: Starting ChromeDriver [version_number] on port [port_number] [Date &
[Date & Time] [INFO]: ChromeDriver was started successfully. [Date &
[Date & Time] [INFO]: Title of the page matches the expected value [Date &
[TestNG] Results:
RESULT:
Thus the java program for build BDD framework with Selenium, TestNG and Cucumber.
40