Software Testing Lab Manual-1
Software Testing Lab Manual-1
I|Page
Software Testing (4360706)
II | P a g e
Software Testing (4360706)
Practical No.1:
A). Create a glossary of at least five software testing terminologies with explanations.
B). Describe why both SDLC and STLC are essential in the software development process.
A. Objective:
E. Practical Outcome(PRo)
Describe various software testing terminologies, SDLC & STLC lifecycle which
will be helpful in software testing.
1|Page
Software Testing (4360706)
G. Prerequisite Theory:
Software testing is a systematic process of evaluating a software application to
identify any defects, errors, or discrepancies between expected and actual outcomes. It
involves the execution of a program or system with the intent of finding errors and
ensuring that the software behaves as intended. Testing is a crucial part of the software
development life cycle (SDLC) and is performed at various stages to guarantee the
delivery of a high- quality and reliable software product.
2|Page
Software Testing (4360706)
In software testing and development, terms like "Bug," "Defect," "Error," "Fault," and
"Failure" are often used to describe different aspects of issues or problems. While these
terms are sometimes used interchangeably, they have specific meanings in the context of
software engineering.
1. Bug:
Definition: A bug is a term often used interchangeably with "defect" or "error."
It refers to a flaw, mistake, or unintended behavior in a software application.
Bugs can occur in the code, design, or system architecture and may lead to
incorrect or unexpected results.
2. Defect:
Definition: A defect is a deviation or flaw in the software product that does not
conform to its specifications or requirements. It is a broader term that
encompasses any problem, whether it is in the code, design, documentation, or
other aspects of the software.
3. Error:
3|Page
Software Testing (4360706)
An error made by a developer (human action) can result in a fault in the code or system.
A fault, when executed or triggered, may lead to a defect in the system.
A defect is a broad term encompassing any problem in the software, whether it
originated from an error or a fault.
Bugs are manifestations of defects in the software that may cause failures during
system operation.
Example Scenario:
1. Developer Error: A developer makes a coding mistake (error) while implementing a
new feature.
2. Fault: The coding mistake results in a fault in the code.
3. Defect: The fault manifests as a defect in the software.
4. Bug: Users report unexpected behavior or incorrect results, indicating the presence of
a bug.
5. Failure: The observed incorrect behavior during actual system use is a failure.
4|Page
Software Testing (4360706)
Understanding these terms and their relationships is crucial in software testing and
debugging processes, as it helps in effectively communicating issues within the
development and testing teams.
1.3 Verification and Validation (V Model)
The V Model, also known as the Verification and Validation Model, is a software
development and testing framework that emphasizes the relationship between
development phases and corresponding testing activities. It is called the V Model
because of its characteristic V-shaped representation. The left side of the "V"
represents the development phases, and the right side represents the corresponding
testing phases. The model highlights the interdependence of verification and validation
processes.
Verification:
Definition: Verification is the process of ensuring that the product is designed and
implemented correctly based on the specified requirements.
In the V Model: The left side of the V represents the verification process. Each stage of
the development phase has a corresponding stage in the testing phase.
Activities:
Requirements Analysis: Verification of requirements to ensure clarity,
completeness, and consistency.
System Design: Verification of the system design against the requirements.
Architecture Design: Verification of the software architecture design.
Module Design: Verification of the detailed module-level design.
Coding: Verification of the source code against the design.
Validation:
5|Page
Software Testing (4360706)
Definition: Validation is the process of evaluating the product during or at the end of
the development process to determine whether it satisfies the specified requirements.
In the V Model: The right side of the V represents the validation process. Each testing
phase is associated with a specific development phase, and validation activities are
performed.
Activities:
Unit Testing: Validation of individual units or components of the software.
Integration Testing: Validation of interactions between integrated components
or systems.
System Testing: Validation of the entire software system.
User Acceptance Testing (UAT): Validation by end-users to ensure the
software meets their requirements.
1. Parallel Development and Testing: Unlike the traditional waterfall model, where
testing is a separate phase after development, the V Model involves parallel
development and testing activities.
2. Early Detection of Defects: Defects are detected and addressed at an early stage,
reducing the cost and effort of fixing issues later in the development process.
3. Traceability: The model emphasizes traceability between the development and testing
phases, ensuring that each component of the software is linked to its corresponding
testing activity.
4. Comprehensive Testing: The model promotes comprehensive testing by including
various levels of testing (unit, integration, system, and acceptance) throughout the
development process.
The V Model is particularly useful for projects with well-defined requirements and where
changes are less likely to occur. It offers a systematic approach to software development
and testing, ensuring that the final product meets specified requirements.
1.4 Quality Assurance and Quality Control
6|Page
Software Testing (4360706)
Quality Assurance
Quality assurance (QA) in software testing is a systematic process that ensures that
the software development and testing processes are well-defined, efficient, and result in
the delivery of high-quality software. QA activities aim to prevent defects, verify that
processes are followed, and provide confidence in the reliability of the software being
developed. Here's a detailed description of quality assurance in software testing:
Quality assurance is a set of planned and systematic actions to ensure that the
software development and testing processes result in a product that meets specified
requirements and is free of defects.
Ensure that the software development and testing processes are well-defined,
repeatable, and effective.
Identify and eliminate defects early in the development life cycle to reduce the cost
of fixing issues.
Establish and enforce standards and processes to improve consistency and reliability.
Provide confidence to stakeholders that the software meets quality expectations.
7|Page
Software Testing (4360706)
Quality Control
Quality control in software testing refers to the process of ensuring that the
software being developed or maintained meets the specified quality standards and
requirements. It involves systematic activities and methodologies aimed at identifying
and correcting defects or deviations from the desired quality. Here's a detailed
description of quality control in software testing:
The primary goal of quality control in software testing is to ensure that the software
product meets the defined quality criteria, adheres to specifications, and satisfies
user expectations.
Test Planning: Quality control begins with the creation of a comprehensive test
plan. This plan outlines the testing approach, resources, schedule, and objectives to
ensure systematic and organized testing activities.
Test Design: The development of test cases and test scenarios based on
requirements and specifications. Test design aims to verify that the software
functions as intended under various conditions.
8|Page
Software Testing (4360706)
Test Execution: Running the test cases to execute the planned testing activities.
This involves comparing the actual behavior of the software with the expected
results to identify any discrepancies.
Defect Logging and Tracking: When discrepancies or defects are identified, they
are logged in a defect tracking system. Quality control involves not only finding
defects but also managing them effectively, including tracking their status,
severity, and resolution.
Regression Testing: Ensuring that changes or fixes do not negatively impact
existing functionalities. This involves re-executing previously executed test cases
to verify that the modifications have not introduced new defects.
Test Reporting: Regular reporting on the progress of testing activities, including test
execution status, defect metrics, and other relevant information. This helps
stakeholders make informed decisions about the software's readiness for release.
Test Closure: A formal process to assess whether the testing objectives have been
met and to obtain approval to release the software. It involves generating a test
summary report and archiving testware for future reference.
Testing Techniques in Quality Control:
Black Box Testing: Focuses on the external behavior of the software without
knowledge of its internal implementation. Examples include functional testing,
usability testing, and acceptance testing.
White Box Testing: Examines the internal logic and structure of the software.
Examples include unit testing, code coverage analysis, and structural testing.
Gray Box Testing: Combines elements of both black box and white box testing,
where the tester has partial knowledge of the internal workings of the software.
3. Quality Control Tools:
Test Management Tools: Tools that help in planning, designing, executing, and
tracking tests. Examples include TestRail, HP ALM, and Jira.
Defect Tracking Tools: Tools used to log, track, and manage defects throughout the
testing process. Examples include Bugzilla, Jira, and Mantis.
Automation Testing Tools: Tools that enable the automation of repetitive and time-
consuming testing tasks. Examples include Selenium, Appium, and JUnit.
4. Continuous Improvement:
9|Page
Software Testing (4360706)
10 | P a g e
Software Testing (4360706)
structured
11 | P a g e
Software Testing (4360706)
approach that helps ensure the quality and effectiveness of the software. The SDLC
consists of several phases, each with its own set of activities and deliverables.
1. Planning:
Objective: Define the project scope, goals, and requirements. Identify
constraints such as budget and timeline.
Activities:
Conduct feasibility studies
Define project scope
Create a project plan
Define roles and responsibilities
2. Feasibility Study:
Objective: Assess the technical and economic feasibility of the project.
Activities:
Evaluate technical feasibility
Assess economic feasibility
Analyze legal and ethical considerations
3. System Design:
Objective: Define the architecture, components, modules, data, and
interfaces of the system.
Activities:
Create a high-level design
Define system architecture
Develop detailed specifications
12 | P a g e
Software Testing (4360706)
The Software Testing Life Cycle (STLC) is a set of processes and activities
performed by testing teams to ensure the quality and reliability of a software product.
The STLC outlines the steps and phases that testers go through from the initial
13 | P a g e
Software Testing (4360706)
planning
14 | P a g e
Software Testing (4360706)
to the final release of the software. While the specific activities and phases may vary
based on the testing approach and methodologies adopted, here is a generalized
breakdown of the Software Testing Life Cycle:
1. Requirement Analysis:
Objective: Understand and analyze the requirements from a testing
perspective.
Activities:
Review and analyze the software requirements.
Identify testable requirements and potential risks.
Create a Test Plan outlining the testing strategy, scope, resources,
schedule, and deliverables.
2. Test Planning:
Objective: Plan and define the testing approach based on the project
requirements and scope.
Activities:
Define test objectives and entry/exit criteria.
Identify test deliverables.
Allocate resources, roles, and responsibilities.
Develop a test schedule.
3. Test Case Design:
Objective: Create detailed test cases based on the requirements and design
specifications.
Activities:
Develop test scenarios and test cases.
Define test data and expected results.
Ensure test cases cover various scenarios, including positive and
negative test cases.
15 | P a g e
Software Testing (4360706)
4. Test Environment Setup:
STLC is adaptable and may vary based on the project, organization, or testing
methodologies used. The goal of STLC is to systematically and efficiently conduct
testing activities to ensure the quality and reliability of the software being developed. It
is often closely integrated with the development process, ensuring that testing is
performed at each appropriate stage of the SDLC.
16 | P a g e
Software Testing (4360706)
18 | P a g e
Software Testing (4360706)
Practical No.2: Enlist and present at least three popular testing methodologies
(e.g., Agile, Waterfall etc.) with its advantages and disadvantages.
A. Objective:
To know about how to various phases of model related to testing action that ensures
the delivery of high-quality software that meets specified requirements and satisfies
user expectations using various software testing methodologies.
E. Practical Outcome(PRo)
Describe various software testing methodologies with pros and cons.
19 | P a g e
Software Testing (4360706)
G. Prerequisite Theory:
Software Testing methodologies are the approaches and strategies used for
testing a precise product to make sure it is fit for purpose. Software testing methodologies
are essential as they play a critical role in ensuring the quality, reliability, and effectiveness
of software applications.
Some well-accepted testing methodologies comprise – Waterfall model, Agile
methodology, iterative model, verification and validation Methodology (V-Model), Spiral
Model, Extreme Programming Model, RAD (Rapid Action Development) Methodology,
and many others.
Waterfall Model
The Waterfall Model is a traditional and linear approach to software development and
testing. In the context of software testing methodologies within the Waterfall Model,
testing is typically performed in a sequential and phase-dependent manner. Here's how
software testing is integrated into each phase of the Waterfall Model:
1. Requirements Phase:
Testing Focus: In this phase, the focus is on reviewing and validating the
requirements documentation to ensure they are complete, clear, and unambiguous.
Testing Activities: Testers may engage in requirements reviews, walkthroughs,
and inspections to identify potential issues early on.
2. Design Phase:
20 | P a g e
Software Testing (4360706)
Testing Focus: The design phase involves creating detailed design specifications
based on the requirements. Testing activities in this phase aim to ensure that the
design meets the specified requirements and is feasible.
Testing Activities: Design reviews, architectural reviews, and inspections may be
conducted to validate the design.
3. Implementation (Coding) Phase:
Testing Focus: The coding phase involves actual software development based on
the design specifications. Testing activities aim to identify and correct coding
errors and ensure compliance with coding standards.
Testing Activities: Unit testing is the primary focus during this phase, where
individual units or modules are tested in isolation to verify their correctness.
4. Testing Phase:
Testing Focus: This is a dedicated testing phase where the entire software system
is tested as a whole. The objective is to identify and fix defects and ensure that the
software meets the specified requirements.
Testing Activities: Integration testing, system testing, and acceptance testing are
performed sequentially. Each level of testing verifies different aspects of the
software's functionality and integration.
5. Deployment Phase:
Testing Focus: The deployment phase involves delivering the tested and validated
software to the end-users or customers.
Testing Activities: User acceptance testing (UAT) may be conducted in
collaboration with end-users to ensure that the software meets their expectations
and is ready for deployment.
6. Maintenance Phase:
Testing Focus: The maintenance phase involves fixing defects, addressing issues,
and making enhancements to the software based on user feedback and changing
requirements.
Testing Activities: Regression testing is a crucial activity during maintenance to
ensure that new changes do not introduce new defects or negatively impact existing
functionality.
Advantages of the Waterfall Model for Testing:
Well-structured and easy to understand.
Clear documentation at each phase.
Straightforward project management and progress tracking.
Disadvantages of the Waterfall Model for Testing:
Limited flexibility for changes after the project has started.
Late detection of defects as testing is performed after development.
Long development and testing cycles.
21 | P a g e
Software Testing (4360706)
It's important to note that while the Waterfall Model has been widely used
in the past, many modern development methodologies, such as Agile, emphasize iterative
and more flexible approaches to software development and testing. These methodologies
aim to address some of the limitations of the Waterfall Model by incorporating continuous
feedback and adaptation throughout the development process.
Agile Model
In the Agile model, testing is an integral and continuous part of the software development
process. Agile methodologies, such as Scrum, Kanban, and Extreme Programming (XP),
emphasize collaboration, adaptability, and customer feedback. Below is an overview of
how testing is integrated into the Agile model:
o User Stories and Product Backlog:
Agile development starts with a product backlog containing user stories,
each representing a specific functionality or feature.
Testing Focus: Testers collaborate with the product owner and
development team to understand user stories and define acceptance criteria.
o Sprint Planning:
Agile projects are divided into fixed-length iterations called sprints, usually
2-4 weeks.
Testing Focus: Testers participate in sprint planning meetings to discuss
testing requirements for the upcoming user stories. They help estimate the
testing effort and plan test activities for the sprint.
o Daily Stand-ups:
Daily stand-up meetings facilitate communication within the team,
providing updates on progress and discussing any impediments.
Testing Focus: Testers share their progress, discuss testing challenges, and
collaborate with developers to address any issues promptly.
o Continuous Integration:
Agile teams often use continuous integration to merge code changes
frequently, ensuring that the software is continually built and tested.
Testing Focus: Automated tests, including unit tests, integration tests, and
other automated checks, are integrated into the continuous integration
process to provide rapid feedback on code changes.
o Incremental Development:
Agile projects emphasize delivering a potentially shippable product
increment at the end of each sprint.
Testing Focus: Testers continuously verify and validate features
throughout the sprint, ensuring that each increment meets the acceptance
criteria and is free of critical defects.
22 | P a g e
Software Testing (4360706)
o Continuous Testing:
Agile teams practice continuous testing to identify defects early in the
development process.
Testing Focus: Automated testing, exploratory testing, and other testing
activities are performed continuously throughout the development cycle,
promoting a sustainable pace for the team.
o Sprint Review:
At the end of each sprint, the team conducts a sprint review to demonstrate
the completed work to stakeholders.
Testing Focus: Testers showcase the tested features, and stakeholders
provide feedback. Any necessary adjustments are discussed for future
sprints.
o Sprint Retrospective:
A sprint retrospective is conducted to reflect on the sprint, identify areas for
improvement, and make adjustments for the next iteration.
Testing Focus: Testers provide insights into testing processes and suggest
improvements, contributing to the team's continuous improvement.
o Release and Deployment:
Agile projects can release increments to production at the end of each sprint
or combine multiple increments for larger releases.
Testing Focus: Final acceptance testing and validation are performed
before releasing the product increment to production.
Advantages of Agile Testing:
Early and continuous feedback from stakeholders.
Rapid identification and resolution of defects.
Flexibility to adapt to changing requirements.
Collaboration between development and testing teams.
Challenges of Agile Testing:
Requires strong collaboration and communication.
Continuous time and resource constraints.
Relies heavily on automated testing for efficiency.
23 | P a g e
Software Testing (4360706)
Spiral Model
Here's a general overview of how the Spiral Model can be adapted for software testing:
1. Planning:
Identify the objectives, risks, and alternatives.
Plan the testing activities, including defining test objectives, scope, and criteria.
2. Risk Analysis:
Evaluate potential risks and uncertainties associated with the project.
Prioritize and determine the impact of each risk on the project.
3. Engineering:
Develop a prototype or initial version of the software.
Conduct unit testing on individual components/modules.
4. Evaluation:
Review the prototype with stakeholders, including testers, to gather feedback.
Evaluate the prototype in terms of functionality, performance, and other
relevant criteria.
5. Test Planning:
Based on feedback and evaluation, plan the testing for the next iteration.
Update the test strategy and test plan accordingly.
24 | P a g e
Software Testing (4360706)
6. Testing:
Conduct various types of testing (unit, integration, system, etc.) during each
iteration.
Identify and document defects, if any, and prioritize them for resolution.
7. Risk Resolution:
Address and mitigate the identified risks.
Update the risk assessment based on the progress of the project.
8. Re-evaluation:
Review and evaluate the modified software after addressing the risks and
making changes.
Gather feedback from stakeholders, including users and testers.
9. Iterate:
Repeat the spiral for subsequent iterations, incorporating improvements and
changes based on feedback and testing results.
1. Early Testing:
Testing activities are initiated early in the development process.
Incremental releases of the software are tested and validated in each iteration.
2. Risk-Driven:
The model emphasizes risk analysis and management.
Testing activities focus on areas with high levels of risk, ensuring they are
thoroughly tested.
3. Flexibility:
The model is adaptable to changes in requirements.
Testing efforts are adjusted based on the evolving understanding of the system.
4. Customer Involvement:
Regular customer feedback is sought, and the software is evaluated by the
customer at the end of each iteration.
5. Iterations:
The development and testing process is carried out in iterative cycles.
Each iteration results in a new version of the software.
6. Documentation:
Documentation is maintained and updated throughout the process, reflecting
the current state of the software.
While the Spiral Model offers flexibility and accommodates changes during the
development process, it requires a thorough understanding of the application domain and
continuous risk assessment. Additionally, the model may involve more time and resources
25 | P a g e
Software Testing (4360706)
compared to some other software development methodologies.The Spiral Model allows for
flexibility and responsiveness to changes throughout the development process. It helps in
accommodating changes in requirements, addressing risks, and ensuring that testing
activities are integrated at various stages. It's crucial to adapt the model according to the
specific needs of the project and the testing methodology being used, such as agile testing
or traditional testing approaches.
H. Practical related Exercises.
1. Which testing approach is characterized by short development cycles,
frequent releases, and continuous integration?
A) Waterfall testing
B) Agile testing
C) V-Model testing
D) Incremental testing
2. Which testing methodology is characterized by a series of repeating cycles,
each involving planning, risk analysis, engineering, testing, and evaluation?
A) Waterfall
B) Spiral
C) Agile
D) V-Model
3. In which testing methodology is the development process divided into
small, fixed-length iterations or sprints?
A) Waterfall
B) Incremental
C) RAD (Rapid Application Development)
D) Scrum (Agile Framework)
4. Which testing methodology involves the development of a working model
of the system at an early stage and refining it iteratively?
A) Waterfall
B) Prototype
C) Incremental
D) RAD (Rapid Application Development)
5. Which testing methodology is known for its emphasis on risk analysis and
mitigation throughout the development process?
A) Agile
B) Spiral
C) Waterfall
D) Incremental
26 | P a g e
Software Testing (4360706)
Practical No.3: Write program and design test cases for the following Control and
decision-making statement.
1) For... Loop 2) Switch...case 3) Do... While 4) If...else.
A. Objective:
To assess the software's behavior under various conditions, helping identify and
address potential issues in the application's functionality.
To create well-structured, comprehensive, and effective test cases for control and
decision-making statements in software development.
Design various test cases based on specification of application.
27 | P a g e
Software Testing (4360706)
E. Practical Outcome(PRo)
Design test cases for the looping structure and decision-making statement.
G. Prerequisite Theory:
Test Case:
A test case is a detailed set of conditions, inputs, and expected outcomes that are
designed to verify whether a particular feature or aspect of a software application
functions as intended. Test cases help ensure that software meets the specified
requirements and behave correctly under various scenarios. Each test case
represents a unique testing scenario and provides a way to systematically validate
the functionality of the software.
Let's take an example to illustrate the concept of a test case:
28 | P a g e
Software Testing (4360706)
Check that the application displays the user's name or relevant information
on the dashboard.
Confirm that the user receives appropriate feedback, such as a welcome
message or successful login notification.
For Loop:The for loop is used when you know the number of iterations.
<?php
for ($i = 1; $i <= 5; $i++) {
echo "The value of i is: $i <br>";
}
29 | P a g e
Software Testing (4360706)
?>
<?php
$x = 10;
if ($x > 0) {
echo "The value of x is positive.";
}
?>
<?php
$x = 5;
if ($x > 0) {
echo "The value of x is positive.";
} else {
echo "The value of x is non-positive.";
}
?>
30 | P a g e
Software Testing (4360706)
<?php
function calculateSum($n) {
$sum = 0;
for ($i = 1; $i <= $n; $i++) {
$sum += $i;
}
return $sum;
31 | P a g e
Software Testing (4360706)
}
$number = 5;
$result = calculateSum($number);
echo "Sum of numbers from 1 to $number is: $result\n";
?>
Test Cases:
1. Valid Positive Input:
Input: 5
Expected Output: 15 (1 + 2 + 3 + 4 + 5)
32 | P a g e
Software Testing (4360706)
Feel free to modify the test cases based on the specific requirements of your
program and the constraints of your system.
Note: Students have to write test cases for remaining control and decision
making statement.
H. Practical related Exercises.
1. What is the primary purpose of test cases in software development?
a. To write code faster
b. To detect and fix bugs
c. To impress clients
d. To increase file size
2. What is a test case in the context of software testing?
a. A bug in the code.
b. A condition that is always true.
c. A set of conditions and inputs to verify the correct behavior of a program.
d. A statement that cannot be tested.
3. Why is it important to design test cases for different branches of decision-
making statements?
a. To confuse developers.
b. To increase code complexity.
c. To ensure that all possible code paths are tested.
d. To make the code longer.
4. Which of the following statements is true about boundary testing in
decision-making statements?
a. It is not necessary for robust testing.
b. It focuses on values outside the normal range.
c. It only tests the most common cases.
d. It is performed after the software is deployed.
5. What is the benefit of designing test cases for loops?
a. To make the code shorter.
b. To avoid using loops altogether.
b. To ensure that the loop terminates properly and produces correct results.
d. Test cases are not relevant for loops.
33 | P a g e
Software Testing (4360706)
Practical No.4: Design test cases for different tasks (OTP Verification, Image
upload, Age verification in Registration) in any software modules using
Equivalence partitioning, boundary value analysis, and decision table testing
techniques of Black Box Testing.
A. Objective:-
Cover different aspects of the software's functionality, ensuring that it behaves as
expected under various conditions. Equivalence Partitioning focuses on grouping
input values into classes, Boundary Value Analysis tests values at the edges of these
classes, and Decision Table Testing addresses combinations of input conditions and
their expected results. These techniques help maximize test coverage and identify
potential issues early in the testing process.
34 | P a g e
Software Testing (4360706)
C. Expected Skills to be developed based on competency:
E. Practical Outcome(PRo)
Design test cases for tasks such as OTP Verification, Image upload, Age
verification using various methods of Black box testing.
F. Expected Affective domain Outcome(ADos)
1. Follow Testing standards and practices.
2. Maintain tools and equipment.
3. Follow safety practices.
4. Follow ethical practices
G. Prerequisite Theory:
Black Box Testing:
Black Box Testing is a software testing method where the tester examines the functionality
of a system without having knowledge of its internal code, structure, or implementation
details. The tester focuses solely on the inputs and outputs of the software under test,
treating it as a "black box" where the internal workings are not visible or known.
Black Box Testing helps identify defects, errors, and discrepancies between expected and
actual outcomes without being influenced by the internal structure of the system. This type
of testing is essential for ensuring the overall quality and reliability of software
applications.
Black Box Testing involves various methods and techniques to ensure that the software
functions correctly according to its specifications without focusing on the internal code
structure. There are various methods of Black Box testing.Here are some common
methods of Black Box Testing:
Equivalence Partitioning:
Equivalence Partitioning is a black-box testing technique that divides the input space of a
software system into classes or groups of data, where each class represents a set of
equivalent inputs. The idea is that if a system behaves correctly for one input in an
equivalence class, it should behave correctly for any input in that class. This technique
helps
35 | P a g e
Software Testing (4360706)
in designing effective and efficient test cases by reducing redundancy and covering a
representative set of inputs.
Example:
Consider a simple login functionality where the user has to enter a username and
password. The requirements specify that the username must be between 5 and 15
characters, and the password must be at least 8 characters long. Equivalence Partitioning
can be applied to design test cases for valid and invalid inputs.
1. Equivalence Classes for Username:
Valid Usernames: "john_doe", "user123"
Invalid Usernames (Too Short): "ab"
Invalid Usernames (Too Long): "thisisaverylongusername"
2. Equivalence Classes for Password:
Valid Passwords: "secure123", "myp@ssword"
Invalid Passwords (Too Short): "pass123"
Invalid Passwords (Valid Length but Weak): "weakpwd"
Equivalence Partitioning Test Cases:
Based on the equivalence classes defined, we can design test cases to cover each class:
1. Valid Username and Valid Password:
Input: Username = "john_doe", Password = "secure123"
Expected Result: Successful login
2. Invalid Username (Too Short) and Valid Password:
Input: Username = "ab", Password = "myp@ssword"
Expected Result: Login failure due to an invalid username length
3. Valid Username and Invalid Password (Too Short):
Input: Username = "user123", Password = "pass123"
Expected Result: Login failure due to an invalid password length
4. Invalid Username (Too Long) and Invalid Password (Valid Length but Weak):
Input: Username = "thisisaverylongusername", Password = "weakpwd"
Expected Result: Login failure due to both invalid username length and weak
password
5. Valid Username and Invalid Password (Valid Length but Weak):
Input: Username = "john_doe", Password = "weakpwd"
Expected Result: Login failure due to a weak password
These test cases cover different equivalence classes, ensuring that the software is tested for
various scenarios and that it responds correctly to both valid and invalid inputs within each
class.
Boundary Value Analysis (BVA):
Boundary Value Analysis is a black-box testing technique that focuses on testing values at
the boundaries or edges of input ranges. The idea is that errors often occur at the extremes
of the input domain, and testing values at these boundaries helps ensure the robustness of
36 | P a g e
Software Testing (4360706)
the software. BVA is commonly used in scenarios where input values must fall within a
specific range.
Process of Boundary Value Analysis:
1. Identify Input Ranges: Determine the input ranges or domains that the software operates
within. This could include ranges for variables, such as age, salary, or any other numeric
or alphanumeric input.
2. Select Boundary Values: Choose values that are at the lower, upper, and just beyond the
boundaries of the identified ranges. These values are often more likely to cause errors.
3. Design Test Cases: Create test cases using the selected boundary values. Test cases
should include both valid and invalid scenarios to ensure that the software behaves
correctly in all situations.
4. Execute Test Cases: Run the test cases and observe the software's behavior. Check if it
handles boundary values properly and produces the expected results.
Example of Boundary Value Analysis:
Let's consider a simple example of a program that accepts an age input between 18 and 65.
The program determines whether a person is eligible for a certain service based on their
age. Here's how you might apply Boundary Value Analysis to this scenario:
1. Identify Input Ranges:
Age should be between 18 and 65 (inclusive).
2. Select Boundary Values:
Lower Bound: 18 (just above the minimum)
Upper Bound: 65 (just below the maximum)
Values just beyond the bounds: 17 (below the minimum) and 66 (above the
maximum)
3. Design Test Cases:
Test Case 1: Age = 17 (Invalid - below the minimum)
Test Case 2: Age = 18 (Valid)
Test Case 3: Age = 30 (Valid)
Test Case 4: Age = 65 (Valid)
Test Case 5: Age = 66 (Invalid - above the maximum)
4. Execute Test Cases:
Check if the program correctly identifies Test Case 1 and Test Case 5 as
invalid, while Test Cases 2, 3, and 4 are valid.
Benefits of Boundary Value Analysis:
Helps identify potential errors at the edges of input ranges.
Provides more thorough coverage of input scenarios.
Efficiently targets areas where errors are likely to occur.
In this example, applying Boundary Value Analysis ensures that the age-related
functionality is tested comprehensively, increasing the likelihood of finding defects related
to boundary conditions.
37 | P a g e
Software Testing (4360706)
Decision Table Testing is a black-box testing technique that is used to handle complex
business rules and logic in a concise and systematic manner. It involves creating a decision
table that represents all possible combinations of input conditions and their corresponding
actions or outcomes. This method helps ensure that every possible combination is tested,
making it effective for scenarios where different combinations of inputs can lead to
different outcomes.
Components of a Decision Table:
Conditions (Inputs): Represent the different input conditions that the system can
encounter.
Actions (Outputs): Represent the different actions or outcomes based on the
combinations of input conditions.
Rules: Define the relationship between input conditions and the corresponding
actions.
Example of Decision Table Testing:
Let's consider a simple example of a decision table for a system that determines the
eligibility of a person for a discount based on their age and membership status. The
conditions are "Age" and "Membership," and the action is whether the person is "Eligible"
for a discount.
Action (Eligibility)
Condition 1 (Age) Condition 2 (Membership)
Eligible
Young (< 30) Yes
Not Eligible
Young (< 30) No
Eligible
Middle-aged (30-60) Yes
Not Eligible
Middle-aged (30-60) No
Eligible
Senior (> 60) Yes
Not Eligible
Senior (> 60) No
In this example:
Conditions:
Age is divided into three categories: Young (< 30), Middle-aged (30-60), and
Senior (> 60).
Membership is divided into two categories: Yes or No.
Actions:
Eligibility has two possible outcomes: Eligible or Not Eligible.
38 | P a g e
Software Testing (4360706)
The decision table systematically covers all possible combinations of conditions and their
corresponding outcomes. For instance, the first row represents the scenario where a person
is young (< 30) and has membership, leading to the action "Eligible."
Test Cases: Based on the decision table, we can create specific test cases to validate the
system's behavior:
1. Test Case 1:
Age: Young (< 30)
Membership: Yes
Expected Outcome: Eligible
2. Test Case 2:
Age: Middle-aged (30-60)
Membership: No
Expected Outcome: Not Eligible
3. Test Case 3:
Age: Senior (> 60)
Membership: Yes
Expected Outcome: Eligible
4. Test Case 4:
Age: Middle-aged (30-60)
Membership: Yes
Expected Outcome: Eligible
These test cases cover different combinations of conditions, ensuring that the system
behaves as expected for various scenarios. Decision Table Testing provides a systematic
way to design test cases for complex decision-making processes, helping to identify
potential errors and validate the correctness of the system's logic.
In summary, Black Box Testing is an essential methodology for ensuring the functionality,
reliability, and compliance of a software system with its specified requirements. It
complements other testing methodologies and helps deliver a high-quality software
product to end-users.
39 | P a g e
Software Testing (4360706)
2. What is the primary objective of Boundary Value Analysis in Black Box
Testing?
A. To focus on middle values within input ranges.
B. To identify defects related to input extremes and boundaries.
C. To exclude extreme values from testing.
D. To prioritize testing based on equivalence partitions.
40 | P a g e
Software Testing (4360706)
Practical No.5:
A) Identify system specification & design test cases for Sales Invoice Management.
B) Design Test Cases for Flight Ticket Booking system.
A. Objective:
To ensure the robustness, functionality, and reliability of the Sales Invoice
Management system and Flight Ticket Booking system by establishing a clear
understanding of its requirements and creating effective test cases.
41 | P a g e
Software Testing (4360706)
E. Practical Outcome(PRo)
List out various specification of software and design various test cases as per
mentioned in specification.
F. Expected Affective domain Outcome(ADos)
1. Follow Testing standards and practices.
2. Maintain tools and equipment.
3. Follow safety practices.
4. Follow ethical practices
G. Prerequisite Theory:
A test case template is a standardized document that outlines the conditions, inputs,
expected results, and execution steps for a specific test scenario. This template provides a
structured format for organizing and documenting test cases, ensuring consistency across
testing efforts.
Below is a detailed description of the various components typically included in a test case
template, along with example. However you can use less or more components as per need
of requirements of application.
42 | P a g e
Software Testing (4360706)
5. Inputs:
Detailed information about the data or parameters required for the test.
Example:
Customer information
Product details
Invoice amount
6. Test Steps:
Step-by-step instructions for executing the test, including the necessary actions and
inputs.
Example:
Navigate to the "Create Invoice" section.
Enter customer details (e.g., name, address).
Add products/services to the invoice.
Input invoice amount and relevant details.
Click on the "Submit" button.
Expected Results:
The anticipated outcome or behavior of the system after executing the test steps.
Example: A new sales invoice is created and saved successfully, and the system
displays a confirmation message.
Actual Results:
The actual outcome observed during test execution. Testers record the results after
completing the test.
Example: The sales invoice is successfully created, and the confirmation message
appears as expected.
Pass/Fail Criteria:
Criteria for determining whether the test case has passed or failed based on the
actual results.
Example:
Pass: The invoice is created without errors, and the confirmation message is
displayed.
Fail: The system generates an error message, or the invoice creation process fails.
Notes:
Additional comments, observations, or notes that provide context or insight into the
test execution.
Example: The test was performed on the latest version of the system, and no issues were
encountered during the test execution.
Test Environment/Setup:
Information about the testing environment, including hardware, software, and
configurations used during testing.
43 | P a g e
Software Testing (4360706)
Example: Tested on the Sales Invoice Management system version 2.0 in a Windows
10 environment.
Tested By:
The name or identifier of the tester who executed the test case.
Example: John Tester
Date Tested:
The date when the test case was executed.
Example: January 15, 2024
Test
Test Case Test Expected Actual Created
Case Title Output Output
Description Test Data Steps Status Date By
ID
Explanation of Columns:
1. Test Case ID: A unique identifier for each test case.
2. Test Case Title: A concise title describing the purpose of the test case.
3. Test Case Description: A detailed explanation of the test scenario, including the
context and objectives.
4. Test Data: Detailed information about the data or parameters required for the test.
5. Test Steps: Sequential steps to execute the test case.
6. Expected Result: The anticipated outcome when the test case is executed successfully.
7. Actual Result: The actual outcome observed during test execution (filled in after
execution).
8. Status (Pass/Fail): Indication of whether the test case passed or failed based on the
comparison of actual and expected results.
9. Date: The name or identifier of the tester who executed the test case
10. Created By: The date when the test case was executed.
44 | P a g e
Software Testing (4360706)
These specifications related to invoice creation, editing, duplicate prevention, and deletion.
Additional specifications can be identified based on specific business requirements and
functionalities desired in the Sales Invoice Management system.
45 | P a g e
Software Testing (4360706)
H. Resources/Equipment Required
I. Implementation:
Note: students have to design various test cases consider above and other needed
specification using given above test cases format.
(A) Identify system specification & design test cases for Sales Invoice Management
46 | P a g e
Software Testing (4360706)
47 | P a g e
Software Testing (4360706)
48 | P a g e
Software Testing (4360706)
49 | P a g e
Software Testing (4360706)
50 | P a g e
Software Testing (4360706)
51 | P a g e
Software Testing (4360706)
52 | P a g e
Software Testing (4360706)
1. https://www.geeksforgeeks.org/test-case/
2. https://www.guru99.com/test-case.html
3. https://www.tutorialspoint.com/software_testing_dictionary/test_case.htm
4. https://testsigma.com/guides/what-is-test-case/
L. Assessment-Rubrics
53 | P a g e
Software Testing (4360706)
Practical No.6 Develop test scenarios and test cases for the login functionality of a
social media application.
A. Objective: Create comprehensive test scenarios and cases to rigorously validate the
login functionality of a social media application, ensuring robust security, usability,
and seamless user experience.
54 | P a g e
Software Testing (4360706)
Create test scenarios and cases to validate the seamless and secure login process for
a social media application, covering aspects such as valid and invalid credentials,
multi-factor authentication, and account recovery.
G. Prerequisite Theory:
The process of developing test scenarios and test cases for the login
functionality of a social media application is crucial to ensure the reliability, security, and
user experience of the authentication process. This theory outlines the key aspects and
methodologies involved in this testing phase.test scenarios and test cases for the login
functionality of a social media application.
1. Valid Login:
Scenario: In this scenario, a user enters correct credentials to log in successfully. The
primary objective is to ensure that the application allows authorized users to access their
accounts. Test cases involve navigating to the login page, entering a valid username and
password, and clicking the "Login" button. The expected result is a successful login, and
verification includes checking if the user is redirected to the home page, and user-specific
elements are present.
2. Invalid Login:
Scenario: This scenario focuses on users entering incorrect credentials during login
attempts. Test cases cover various scenarios such as invalid username, invalid password,
and a combination of both. For instance, entering an invalid username, a valid password,
and clicking "Login" should result in an error message indicating invalid credentials.
Verification involves checking the user-friendliness of error messages.
3. Account Lockout:
Scenario: This scenario tests the application's response to a certain number of consecutive
failed login attempts, leading to an account lockout. Test cases include attempting to
exceed the maximum allowed failed login attempts, ensuring the account is locked, and
verifying the reset of the lockout status after a specified duration. Verification involves
checking the account status in the database.
4. Password Recovery:
Scenario: Here, the focus is on users who forget their passwords and initiate the recovery
process. Test cases cover initiating password recovery, receiving a password reset link via
email, and successfully setting a new password using the provided link. Verification
55 | P a g e
Software Testing (4360706)
includes checking the inbox for the reset link and ensuring successful login with the new
password.
5. Social Media Integration:
Scenario: This scenario involves users logging in using their social media credentials.
Test cases include logging in with Facebook and Google accounts, entering valid
credentials, and verifying successful login. Verification involves confirming that user
details are populated from the respective social media profiles.
6. Session Management:
Scenario: The objective here is to test the secure management of user sessions. Test cases
include testing session timeouts and multiple device logins. For instance, logging in and
waiting for the session to expire should prompt the user to log in again. Verification
involves confirming that the session timeout behavior aligns with expectations.
7. UI/UX:
Scenario: This scenario focuses on the user interface and user experience of the login
page. Test cases include verifying the presence of necessary UI elements, testing
responsiveness across different screen sizes, and checking the visibility of error messages.
Verification involves visually inspecting the login page and confirming the responsiveness
using browser developer tools.
8. Security:
Scenario: Ensuring the security of the login process is crucial. Test cases cover potential
vulnerabilities such as SQL injection and Cross-Site Scripting (XSS). For example,
attempting to log in with a username containing SQL injection should result in failure
without executing malicious queries. Verification involves checking logs for any
suspicious activity and ensuring the application is not vulnerable to XSS.
These detailed test scenarios and test cases aim to comprehensively assess the login
functionality of a social media application, covering a range of potential user interactions
and security considerations. Customizing these scenarios based on the specific features and
requirements of the application is essential for effective testing.
Example: Invalid Login Scenario: A user enters incorrect credentials and attempts to
log in.
Test Cases:
1. Enter a valid username and an incorrect password.
2. Enter an invalid username and a valid password.
3. Enter an invalid username and an incorrect password.
4. Verify that appropriate error messages are displayed for each case.
Account Lockout Scenario: After a certain number of consecutive failed login attempts,
the account gets locked.
Test Cases:
1. Exceed the maximum allowed failed login attempts.
56 | P a g e
Software Testing (4360706)
57 | P a g e
Software Testing (4360706)
58 | P a g e
Software Testing (4360706)
59 | P a g e
Software Testing (4360706)
K. References Links
1. Test Scenario - javatpoint
2. What is Test Scenario | Purpose & How to create it (Examples) (testsigma.com)
3. Test Case vs Test Scenario – Difference Between Them (guru99.com)
4. Testscenario - Independent Software Testing Services Company
L. Assessment-Rubrics
60 | P a g e
Software Testing (4360706)
Practical No.7 Develop an RTM and measure testing metrics for any two dynamic
web pages of an e-commerce website.
A. Objective: Create a Requirement Traceability Matrix (RTM) for two dynamic web
pages of an e-commerce site, outlining the relationship between requirements and
test cases. Measure testing metrics such as test coverage, defect density, and
execution time to assess the effectiveness of the testing process.
61 | P a g e
Software Testing (4360706)
It is prepared before the test execution process to make sure that every requirement
is covered in the form of a Test case so that we don't miss out any testing. In the
RTM document, we map all the requirements and corresponding test cases to ensure
that we have written all the test cases for each condition.
The test engineer will prepare RTM for their respective assign modules, and then it
will be sent to the Test Lead. The Test Lead will go repository to check whether the
Test Case is there or not and finally Test Lead consolidate and prepare one
necessary RTMdocument.
62 | P a g e
Software Testing (4360706)
This document is designed to make sure that each requirement has a test case, and
the test case is written based on business needs, which are given by the client. It
will be performed with the help of the test cases if any requirement is missing,
which means that the test case is not written for a particular need, and that specific
requirement is not tested because it may have some bugs. The traceability is written
to make sure that the entire requirement is covered.
A Requirements Traceability Matrix (RTM) is a document that establishes a
relationship between system requirements and the corresponding test cases. It is
used to ensure that all requirements are covered by test cases and to trace the impact
of changes in requirements throughout the testing process. The RTM helps in
maintaining transparency, managing changes, and ensuring comprehensive test
coverage.
Components of an RTM:
1. Requirement ID: A unique identifier for each requirement.
2. Requirement Description: A clear and concise description of each requirement.
3. Test Case ID(s): The test case(s) associated with each requirement.
Purpose of RTM:
Traceability: Link requirements to test cases, ensuring coverage and
traceability.
Change Management: Track changes in requirements and update associated
test cases.
Impact Analysis: Understand the impact of requirement changes on testing.
Coverage Analysis: Assess how well test cases cover the specified
requirements.
63 | P a g e
Software Testing (4360706)
64 | P a g e
Software Testing (4360706)
(2) Calculated Metrics: Data from base metrics are used to create calculated metrics.
The test lead collects this information and transforms it into more useful
information for tracking project progress at the module, tester, and other levels. It’s
an important aspect of the SDLC since it allows developers to make critical
software changes.
65 | P a g e
Software Testing (4360706)
Test Metrics Life Cycle:The below diagram illustrates the different stages in the test
metrics life cycle.
Different stages of
Steps during each stage
Metrics life cycle
66 | P a g e
Software Testing (4360706)
Percentage test cases executed = (No of test cases executed / Total no of test cases
written) x 100
Similarly, it is possible to calculate for other parameters also such as test cases that
were not executed, test cases that were passed, test cases that were failed, test cases
that were blocked, and so on. Below are some of the formulas:
1. Test Case Effectiveness:
Failed Test Cases Percentage = (Total number of failed test cases / Total
number of tests executed) x 100
4. Blocked Test Cases Percentage: During the software testing process, this
parameter determines the percentage of test cases that are blocked.
67 | P a g e
Software Testing (4360706)
Rework Effort Ratio = (Actual rework efforts spent in that phase/ Total
actual efforts spent in that phase) x 100
7. Accepted Defects Percentage: This measures the percentage of defects that are
accepted out of the total accepted defects.
1 No. of requirements 5
68 | P a g e
Software Testing (4360706)
12 Defects fixed 12
69 | P a g e
Software Testing (4360706)
I. Resources/Equipment Required
Sr. Equipment/
Specification
No. Software
Resources
1 Computer System Computer system with operating system:
Windows 7 or higher Ver.,macOS, and Linux,
with 4GB or higher RAM
2 Software Microsoft office or any Open-source spreadsheet
package.
3 Code Editors and CODE Editor (Notepad++, VS Code, Sublime), JAVA
Tools IDE (Eclipse, NetBeans, IntelliJ)
4 Browser Microsoft Edge, Google Chrome etc
70 | P a g e
Software Testing (4360706)
71 | P a g e
Software Testing (4360706)
72 | P a g e
Software Testing (4360706)
73 | P a g e
Software Testing (4360706)
74 | P a g e
Software Testing (4360706)
a) Code Coverage
b) Response Time
c) Requirement Traceability
d) Test Case Effectiveness
4. What is the primary purpose of developing an RTM for dynamic web
pages in an e-commerce website?
a) To track defects
b) To ensure security
c) To establish traceability between requirements and test cases
d) To measure customer satisfaction
5. Which testing metric provides insights into how thoroughly test cases cover
the functionalities of dynamic web pages in an e-commerce website?
a) Defect Density
b) Test Execution Time
c) Test Case Coverage
d) Performance Efficiency
L. References Links
1. What is Requirements Traceability Matrix (RTM) in Testing? (guru99.com)
2. Requirements Traceability Matrix - RTM - GeeksforGeeks
3. Traceability Matrix - javatpoint
4. How to Create Requirements Traceability Matrix (RTM) Example Sample Template
(softwaretestinghelp.com)
M. Assessment-Rubrics
Total /25
75 | P a g e
Software Testing (4360706)
Practical No.8 Execute test cases for a travel booking app and prepare a test
Summary report.
A. Objective: Execute test cases for a travel booking app to validate its
functionality, reliability, and usability, and compile a comprehensive test
summary report.
This practical is expect to develop the following skills in you apply types, levels
and methods of software testing on applications.
1. Identify system with its specification and get familiar with the system.
2. Use the different software testing concepts.
3. Ability to write system specification of the systems.
4. Ability to design test case for given systems.
76 | P a g e
Software Testing (4360706)
Successfully executed test cases for a travel booking app, ensuring functional
requirements are met, and prepared a comprehensive test summary report.
F. Expected Affective domain Outcome(ADos)
G. Prerequisite Theory:
A Travel Booking System is a comprehensive software application designed to
facilitate the seamless planning and reservation of travel-related services. This system
serves as a centralized platform that allows users to effortlessly search, compare, and
book various travel options, including flights, hotels, car rentals, and other
accommodations. Users can access a user-friendly interface to input their travel
preferences, such as destination, dates, and preferences. The system then retrieves and
presents relevant information, enabling users to make informed decisions based on
factors like price, availability, and reviews. Integration with secure payment gateways
ensures smooth and secure transactions. Additionally, the system often incorporates
features for managing user profiles, tracking itineraries, and handling cancellations or
modifications. With advanced functionalities like real-time updates, notifications, and
multichannel support, a Travel Booking System enhances the overall user experience,
providing a convenient and efficient means for individuals to plan and book their travel
arrangements.
List of scenarios for travel booking system.
1. User Registration and Login:
Verify that users can successfully register for an account.
Ensure users can log in using valid credentials.
Validate the system response for invalid login attempts.
2. Search and Booking Functionality:
Test the search functionality for flights, hotels, and other travel
options.
Verify that search results are accurate and relevant.
Ensure users can select and book travel options seamlessly.
3. Payment Process:
Test the payment gateway integration for different payment methods.
Verify that users receive proper payment confirmation.
Validate error handling for failed payment transactions.
4. Cancellation and Refund:
Test the cancellation process for booked flights or accommodations.
77 | P a g e
Software Testing (4360706)
78 | P a g e
Software Testing (4360706)
H. Resources/Equipment Required
79 | P a g e
Software Testing (4360706)
OUTPUT
80 | P a g e
Software Testing (4360706)
81 | P a g e
Software Testing (4360706)
82 | P a g e
Software Testing (4360706)
83 | P a g e
Software Testing (4360706)
84 | P a g e
Software Testing (4360706)
6. What type of testing strategy might involve both manual and automated
testing approaches?
a. Black-box testing
b. White-box testing
c. Gray-box testing
d. Hybrid testing
10. What is the primary focus of the "Conclusion" section in a Test Summary
Report?
a. Providing detailed defect information
b. Summarizing the overall testing effort and key findings
85 | P a g e
Software Testing (4360706)
K. References Links
1. Test Summary Reports Tutorial: Learn with Example & Template (guru99.com)
2. How To Write An Effective Test Summary Report - Software Testing Stuff
3. How To Create A Test Summary Report? (testsigma.com)
L. Assessment-Rubrics
86 | P a g e
Software Testing (4360706)
Practical No.9 Prepare defect report after executing test cases for registration page.
This practical is expect to develop the following skills in you apply types, levels
and methods of software testing on applications.
1. Identify system with its specification and get familiar with the system.
2. Use the different software testing concepts.
3. Ability to write system specification of the systems.
4. Ability to design test case for given systems.
Apply bug identification skills to create a comprehensive defect report for the
software application.
E. Practical Outcome(PRo)
87 | P a g e
Software Testing (4360706)
G. Prerequisite Theory:
Prerequisite: Registration Page developed in PHP or any other language and test
cases for Registration page to execute it and generate defect report.
Defect: A defect in a software product is also known as a bug, error or fault
which makes the software produce an unexpected result as per the software
requirements. For example; incorrect data, system hangs, unexpected errors, missing or
incorrect requirements.
Defect Report: A defect report is a document that has concise details about what
defects are identified, what action steps make the defects show up, and what are the
expected results instead of the application showing error (defect) while taking
particular step by step actions.
Defect reports are usually created by the Quality Assurance team and also by the end-
users (customers). Often customers detect more defects and report them to the support
team of the software development since the majority of the customers curiously tries
out every feature in the application. Now, you know what actually defect and defect
reports are.
A Defect in Software Testing is a variation or deviation of the software application
from end user’s requirements or original business requirements. A software defect is
an error in coding which causes incorrect or unexpected results from a software
program which does not meet actual requirements. Testers might come across such
defects while executing the test cases.
The reason behind why defect reports are created is to help developers to find out the
defects easily and fix them up. A defect report is usually assigned by QA to a
developer who then reads the report and reproduces the defects on the software product
by following the action steps mentioned in the report. After that, the developer fixes
the defects in order to get the desired outcome specified in the report.
That is why the defect reports are important and created carefully. Defect reports
should be short, organized, and straight to the point and covers all the information
that the
88 | P a g e
Software Testing (4360706)
developer needs to detect the actual defects in the report by doing what and how the
one written the defect report detected the defects.
It is usual for QA teams to get defect reports from the clients that are either too short to
reproduce and rectify or too long to understand what actually went wrong.
For example,
Now, how in the world does a developer or QA know what went wrong which doesn’t
meet the client expectation?
In such a case, the developer report to the QA that he couldn’t find any problem or he
may have fixed any other error but not the actual one client detected. So that’s why it’s
really important to create a concise defect report to get bugs fixed.
All right. You have a pretty good idea about what, whys and how’s of a defect report.
So it’s time for what is inside the report.
89 | P a g e
Software Testing (4360706)
d. Critical – These bugs heavily impact the performance of the application. Like
crashing the system, freezes the system or requires the system to restart for
working properly.
8. Attachments:A sequence of screenshots of performing the step-by-step actions
and getting the unexpected result. One can also attach a short screen recording of
performing the steps and encountering defects. Short videos help developers and/or
QA to understand the bugs easily and quickly.
9. Additional information:The platform you used, operating system and version.
And other information which describes the defects in detail for assisting the
developer understand the problem and fixing the code for getting desired results.
10. Reported By: The name of the person who reported the defect.
11. Date Reported: The date when the defect was reported.
The app
Login should
button 1. Open the navigate to The login
not app 2. Click the user's button
functio on the login account does not 01/10/20
001 ning button page respond High High Tester A 24
Now based on this example students can generate Defect report for registration page after
executing test cases.
H. Resources/Equipment Required
Sr. Equipment/
Specification
No Software Resources
.
1 Computer System Computer system with operating system: Windows 7
or higher Ver.,macOS, and Linux, with 4GB or
higher RAM
2 Software Microsoft office or any Open-source spreadsheet
package.
3 Code Editors and Tools CODE Editor (Notepad++, VS Code, Sublime), JAVA
IDE (Eclipse, NetBeans, IntelliJ)
90 | P a g e
Software Testing (4360706)
I. Practical Implementation:
Design defect report for Registration page after executing Test Cases for it.
91 | P a g e
Software Testing (4360706)
92 | P a g e
Software Testing (4360706)
93 | P a g e
Software Testing (4360706)
K. References Links
1. Defect Management Process in Software Testing (Bug Report) (guru99.com)
2. What is Defect or Bug? Defect Reporting Template (artoftesting.com)
3. Defect Report in Software Engineering - GeeksforGeeks
4. How to write a good Defect Report? | BrowserStack
L. Assessment-Rubrics
Total /25
94 | P a g e
Software Testing (4360706)
Practical No.10 Prepare defect report after executing test cases for Withdrawn of
amount from ATM Machine.
This practical is expect to develop the following skills in you apply types, levels
and methods of software testing on applications.
1. Identify system with its specification and get familiar with the system.
2. Use the different software testing concepts.
3. Ability to write system specification of the systems.
4. Ability to design test case for given systems.
Apply bug identification skills to create a comprehensive defect report for the
software application.
95 | P a g e
Software Testing (4360706)
Create a comprehensive defect report following the execution of test cases for
ATM Machine's withdrawal functionality.
F. Expected Affective domain Outcome(ADos)
Verify that customers can successfully withdraw the requested amount from the ATM
machine, and the system handles the transaction accurately and efficiently.
Preconditions:
ATM machine is powered on and operational.
Sufficient funds are available in the account linked to the inserted card.
96 | P a g e
Software Testing (4360706)
Now based on this example students can generate Defect report for
registration page after executing test cases.
97 | P a g e
Software Testing (4360706)
H. Resources/Equipment Required
Sr. Equipment/
Specification
No. Software Resources
I. Practical Implementation:
Design defect report for Withdrawn of amount from ATM Machine after
executing Test Cases for it.
98 | P a g e
Software Testing (4360706)
99 | P a g e
Software Testing (4360706)
100 | P a g e
Software Testing (4360706)
K. References Links
1. How to Write Test Cases for ATM Machine (Sample Scenarios)
(softwaretestinghelp.com)
2. How To Write Test Cases for ATM (Test Scenarios ATM Machine)
(softwaretestingmaterial.com)
3. ATM Simulator Project Report | PDF | Port (Computer Networking) | Network
Socket (scribd.com)
4. Atm simulation mini project using Python programming language | PDF
(slideshare.net)
L. Assessment-Rubrics
101 | P a g e
Software Testing (4360706)
Practical No.11:
A) Install and set up the Selenium WebDriver and necessary drivers (e.g.,
ChromeDriver, GeckoDriver) on your system.
B) Install JUnit, TestNG using an IDE (Integrated Development Environment) like
Eclipse or IntelliJ.
A. Objective:
To gain hands-on experience in setting up a Selenium testing environment with
WebDriver, browser drivers, and popular testing frameworks in their chosen IDEs.
This practical provides a solid foundation for automated testing using
Selenium,JUnit and TestNG
102 | P a g e
Software Testing (4360706)
G. Prerequisite Theory:
Selenium is a powerful and widely used open-source framework for automating web
applications. It provides a suite of tools to support automated testing of web browsers
across different platforms and browsers. Selenium is particularly valuable for quality
assurance and software testing teams to streamline the testing process, enhance test
coverage, and ensure the reliability of web applications.
Selenium WebDriver:
WebDriver is the core component of Selenium, allowing users to interact with web browsers
programmatically. It provides a programming interface to create and execute test scripts.
Selenium IDE (Integrated Development Environment):
Selenium IDE is a browser extension that facilitates record-and-playback functionality. It's
a great tool for quick test script development, but it's primarily used as a prototyping tool.
Selenium Grid:
Selenium Grid allows the parallel execution of test scripts on multiple machines and
browsers. This is useful for reducing test execution time and improving overall efficiency.
Key Features and Advantages:
Cross-Browser Compatibility:
103 | P a g e
Software Testing (4360706)
Selenium supports various browsers such as Chrome, Firefox, Safari, and Internet
Explorer, ensuring that web applications behave consistently across different
environments.
Programming Language Support:
Selenium supports multiple programming languages, including Java, Python, C#, Ruby,
and JavaScript. This flexibility allows teams to choose the language that best fits their
expertise. Platform Independence:
Selenium is platform-independent, meaning it can run on different operating systems like
Windows, Linux, and macOS.
Open Source:
Selenium is open source, fostering a large and active community of developers. This
community contributes to its continuous improvement and provides a wealth of resources
and support.
Extensibility:
Selenium can be extended through the use of plugins and integrations, enabling users to
customize and enhance their testing framework based on specific project requirements.
Selenium Workflow:
Identification of Elements:
Selenium allows testers to identify HTML elements on a web page using various locators
such as ID, name, XPath, CSS selectors, and more.
Test Script Creation:
Test scripts are written in programming languages supported by Selenium (e.g., Java,
Python). These scripts define the sequence of actions to be performed on the web
application.
Execution and Verification:
Selenium executes the test scripts, interacting with the web browser to perform actions like
clicking buttons, filling forms, and navigating through pages. Verification points are
included to check if the application behaves as expected.
Reporting and Analysis:
Selenium provides detailed test reports, facilitating analysis of test results. Reports include
information about passed and failed tests, allowing teams to identify and address issues
promptly.
104 | P a g e
Software Testing (4360706)
Selenium WebDriver is a Java library, so you need to have Java installed on your machine.
Follow the steps mentioned to download and install the Java Development Kit (JDK).
Download JDK:
Visit the official Oracle JDK download page or the OpenJDK website to download the JDK
installer.(Install JDK)
105 | P a g e
Software Testing (4360706)
You should see above information about the installed Java version.
1. Download Eclipse:
Visit the official Eclipse download page: Eclipse Downloads.
Under "Eclipse IDE", choose the edition you want. "Eclipse IDE for Java
Developers" is a popular choice for Java development.
Click the "Download" button.
2. Select Installer:
On the download page, you will see different download options. Choose the
installer appropriate for your operating system (in this case, Windows).
3. Download Installer:
Once you've selected the installer for Windows, click on the download link.
The download should start, and you may need to wait for it to complete.
4. Run Installer:
Locate the downloaded installer file (e.g., eclipse-inst-win64.exe for 64-bit
Windows) and run it.
5. Eclipse Installer:
The Eclipse Installer will open. It will ask you to select an IDE package to
install. Choose the package that suits your needs. For Java development, you
might choose "Eclipse IDE for Java Developers."
106 | P a g e
Software Testing (4360706)
107 | P a g e
Software Testing (4360706)
Add the Selenium WebDriver JAR files. You can download the latest version of
Selenium WebDriver from the official website and add the JAR files (e.g., selenium-
java-x.x.x.jar, selenium-server-standalone-x.x.x.jar).
108 | P a g e
Software Testing (4360706)
You have to download webdriver whichever you are using browser.here i am going
to use chrome browser. Check your chrome browser version and according to that
download chromedriver
[Click here to download chrome web driver.]
Place the driver executable(s) in a directory that is included in your system's PATH
variable or provide the path to the driver executable in your Selenium script.
When starting a WebDriver project in Eclipse, do not forget to import the Java
Client Driver files onto your project. These files will constitute your Selenium
Library.
6. Write a Selenium Test Script:
Create a new Java class in your Eclipse project.
Write a basic Selenium WebDriver script.This example opens the Google
homepage and prints the title: Here's an example using Chrome:
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
109 | P a g e
Software Testing (4360706)
// Navigate to Google
driver.get("https://www.google.com");
JUnit
JUnit is a widely-used testing framework for Java programming language that provides
support for writing and running unit tests. Unit testing is a software testing methodology
where individual units or components of a software application are tested in isolation to
ensure they behave as expected. JUnit facilitates the creation of automated test cases to
verify the correctness of specific sections of code.
110 | P a g e
Software Testing (4360706)
If you have successfully installed ecllips IDE then JUnitis available in it we only need to
configure in it our project.If you don't have JUnit in your Eclipse workspace, you need to
download it from official website.Let see how to configure it with in our project.
Configuring JUnit in Eclipse involves adding the JUnit library to the build path of your
project. Here are the steps to configure JUnit in Eclipse using the Build Path options:
1. Open Eclipse: Start Eclipse and open your Java project.
2. Create a New Java Class: If you don't have a Java class or test class yet, create one.
Right-click on the src folder in your project, select New -> Class, and give it a name.
3. Write a Test Method: In your Java class, write a method that will serve as a JUnit
test. Annotate it with @Test.
import static org.junit.Assert.assertEquals;
import org.junit.Test;
public class MyTestClass {
@Test
public void myTestMethod() {
// Your test logic here
assertEquals(4, 2 + 2);
}
} .
Here you may get error but once you add JUnit jar files it will be solved which is given
below
4. Add JUnit Library to the Build Path:
Right-click on your project in the Project Explorer.
Select Properties.
5. Navigate to Java Build Path:
In the Properties dialog, go to Java Build Path in the left navigation.
6. Add JUnit Library:
Click on the Libraries tab.
Click on the Add Library button.
7. Select JUnit:
Choose JUnit and click Next.
8. Choose JUnit Library Version:
Select the JUnit version you want to use (e.g., JUnit 4 or JUnit 5).
Click Finish.
9. Apply and Close:
Click Apply and Close to save the changes and close the dialog.
111 | P a g e
Software Testing (4360706)
Ensure that you have the necessary JUnit JARs in your project's build path, and Eclipse
will automatically recognize and run your JUnit tests.
Here you can see that we have created one test case in program for addition of 2
numbers and set actual value is 4 that is matched with expected value. Our test case is
passed indicated by green color due to match both value that is our goal which is
assume
112 | P a g e
Software Testing (4360706)
mentioned in test case. In this way we can perform various test cases of test suite for
web application.
Now suppose if you are going to change value of expected value as shown below then
your test case will become fail indicate by red color.
113 | P a g e
Software Testing (4360706)
import org.testng.annotations.Test;
public class MyTest {
@Test
public void myTestMethod()
{ System.out.println("TestNG test method executed!");
}
}
3. Right-click on the test method or the class.
4. Select Run As -> TestNG Test.
If everything is set up correctly, you should see the output in the Eclipse console indicating
that the TestNG test method has been executed.
By following these steps, you've manually added TestNG to your Eclipse project, and you
can now start writing and running TestNG.Keep in mind that when working on larger
projects, using a build tool like Maven or Gradle is often recommended for better
dependency management and project organization.
H. Resources/Equipment Required
Sr. Equipment/
Specification
No Software Resources
.
1 Computer System Computer system with operating system: Windows 7
or higher Ver.,macOS, and Linux, with 4GB or
higher RAM
2 Software Microsoft office or any Open-source spreadsheet
package.
3 Code Editors and Tools CODE Editor (Notepad++, VS Code, Sublime), JAVA
IDE (Eclipse, NetBeans, IntelliJ)
114 | P a g e
Software Testing (4360706)
I. Implementation:
Put screenshots of installed eclipse IDE and configure Selenium framework
library, selenium web driver, Junit and TestNG library of your project.
115 | P a g e
Software Testing (4360706)
116 | P a g e
Software Testing (4360706)
117 | P a g e
Software Testing (4360706)
118 | P a g e
Software Testing (4360706)
C) System.setChromeProperty("webdriver.chrome.driver",
"path/to/chromedriver");
D) SetProperty.Chrome("path/to/chromedriver");
4. In Eclipse IDE, how do you add JUnit to your Java project?
A) Right-click project > Properties > Libraries > Add Library > JUnit
B) Right-click project > Build Path > Configure Build Path > Libraries > Add
Library > JUnit
C) Right-click project > Run As > JUnit Test
D) Right-click project > JUnit > Add Library
5. What is the purpose of GeckoDriver in Selenium?
(A).To handle Edge browser automation
(B). To handle Internet Explorer automation
(C). To handle Firefox browser automation
(D). To handle Safari browser automation
K. References / Suggestions
1. https://www.javatpoint.com/selenium-webdriver-installation
2. https://www.youtube.com/watch?v=nhY_f7_j2cU
3. https://www.guru99.com/installing-selenium-webdriver.html
4. https://intellipaat.com/blog/tutorial/selenium-tutorial/installation/
5. https://www.geeksforgeeks.org/how-to-download-and-install-junit-in-eclipse/
6. https://www.guru99.com/install-testng-in-eclipse.html
L. Assessment-Rubrics
119 | P a g e
Software Testing (4360706)
Practical No 12: Design and run test script for a registration page using
Selenium tool and JUnit.
A. Objective:
To ensure the functionality and reliability of the registration process. Verify that
users can successfully navigate through the registration form, input valid
information, submit the form, and receive confirmation. The objective is to identify
and address any issues related to user registration, providing a robust and error-free
experience for end-users.
120 | P a g e
Software Testing (4360706)
.
D. Expected Course Outcomes(Cos)
Utilize popular testing tools (e.g., Selenium, JUnit, TestNG) for creating and
executing automated test scripts.
E. Practical Outcome(PRo)
Design test cases and run test script for a registration page using Selenium tool and
JUnit.
F. Expected Affective domain Outcome(ADos)
1. Follow Testing standards and practices.
2. Maintain tools and equipment.
3. Follow safety practices.
4. Follow ethical practices
G. Prerequisite Theory:
121 | P a g e
Software Testing (4360706)
By.xpath("xpathExpre driver.findElement(By.xpath("//input[@id='username'
XPath ssion") ]")).sendKeys("user123");
CSS By.cssSelector("cssSe driver.findElement(By.cssSelector(".login-form
Selector lectorValue") input[name='password']")).sendKeys("pass456");
Each locator has its own advantages and considerations. Choose the appropriate one based
on the structure of the HTML document and the specific element you are trying to locate.
XPath and CSS selectors are more flexible and powerful but may be slower than simpler
locators like ID or Name
JUnit Annotations
In JUnit, annotations are used to provide metadata about methods and classes, enabling the
framework to understand how to execute tests. Here's a table describing some commonly
used annotations in JUnit with examples:
122 | P a g e
Software Testing (4360706)
The following code snippets are useful to design test script for automation testing using
selenium and Junit.
Let us understand meaning of various code snippets which are given below.
System.setProperty("webdriver.chrome.driver", "path/to/chromedriver.exe");
This line sets the system property "webdriver.chrome.driver" to the path of the
ChromeDriver executable. This is necessary for Selenium to know where to find the
ChromeDriver binary on your system. Replace "path/to/chromedriver.exe" with the
actual path to your ChromeDriver executable.
2. Initializing the ChromeDriver:
123 | P a g e
Software Testing (4360706)
driver.get("https://www.google.com");
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
124 | P a g e
Software Testing (4360706)
6. driver.findElement().sendKeys():
This line is used to simulate typing into an input field on a web page. It's commonly used
to input data into text fields. Here's an example:
This code provides the basic structure to start Selenium automation using ChromeDriver.
You can add more interactions and assertions within the script to simulate user behavior
and perform testing on the loaded page.
7. driver.findElement().click():
This line is used to simulate a click on a web element, such as a button or a link. Here's an
example:
WebElement button = driver.findElement(By.id("submitBtn"));
button.click();
8. assertTrue():
This is an assertion method commonly used in testing frameworks like JUnit or TestNG to
check if a given condition is true. If the condition is false, the test will fail. Here's an
example:
boolean condition = true; // replace with your actual condition
assertTrue("The condition is not true", condition);
9. assertEquals():
This is another assertion method used to check if two values are equal. If the values are not
equal, the test will fail. Here's an example:
To design test cases and create a test script for a registration page using Selenium with
JUnit, you can follow the steps below. I'll provide basic example test script for a simple
registration page.
Below is a simple example by considering following test cases using Java, Selenium
WebDriver, and JUnit.
Test Case Design for Registration page:
Test Case 1: Verify the Registration Page Elements
125 | P a g e
Software Testing (4360706)
Make sure you have the necessary Selenium WebDriver and browser driver versions
compatible with each other. You can download the ChromeDriver executable from the
ChromeDriver downloads page. Adjust the WebDriver setup according to the browser
you intend to use.
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.junit.After;
import org.junit.Before;
126 | P a g e
Software Testing (4360706)
import org.junit.Test;
import static org.junit.Assert.*;
@Before
public void setUp() {
System.setProperty("webdriver.chrome.driver", "path/to/chromedriver.exe");
driver = new ChromeDriver();
}
@After
public void tearDown() {
driver.quit();
}
@Test
public void testRegistrationPageElements() {
driver.get(baseUrl);
// Add assertions to check if all required elements are present
assertTrue(driver.findElement(By.id("username")).isDisplayed());
assertTrue(driver.findElement(By.id("email")).isDisplayed());
assertTrue(driver.findElement(By.id("password")).isDisplayed());
assertTrue(driver.findElement(By.id("confirmPassword")).isDisplayed());
assertTrue(driver.findElement(By.id("registerButton")).isDisplayed());
}
@Test
public void testSuccessfulRegistration() {
driver.get(baseUrl);
// Enter valid data into all required fields
driver.findElement(By.id("username")).sendKeys("testuser");
driver.findElement(By.id("email")).sendKeys("[email protected]");
driver.findElement(By.id("password")).sendKeys("test123");
driver.findElement(By.id("confirmPassword")).sendKeys("test123");
// Click on the "Register" button
driver.findElement(By.id("registerButton")).click();
// Verify successful registration (e.g., check for success message or redirection)
127 | P a g e
Software Testing (4360706)
assertTrue(driver.getCurrentUrl().contains("success"));
}
@Test
public void testUnsuccessfulRegistrationMissingField() {
driver.get(baseUrl);
// Leave one or more required fields blank
driver.findElement(By.id("username")).sendKeys("testuser");
// Click on the "Register" button
driver.findElement(By.id("registerButton")).click();
// Verify that an error message is displayed
WebElement errorMessage = driver.findElement(By.id("error-message"));
assertTrue(errorMessage.isDisplayed());
assertEquals("Please fill in all required fields", errorMessage.getText());
}
@Test
public void testUnsuccessfulRegistrationInvalidEmail() {
driver.get(baseUrl);
// Enter an invalid email address
driver.findElement(By.id("username")).sendKeys("testuser");
driver.findElement(By.id("email")).sendKeys("invalidemail");
driver.findElement(By.id("password")).sendKeys("test123");
driver.findElement(By.id("confirmPassword")).sendKeys("test123");
// Click on the "Register" button
driver.findElement(By.id("registerButton")).click();
// Verify that an error message is displayed
WebElement errorMessage = driver.findElement(By.id("error-message"));
assertTrue(errorMessage.isDisplayed());
assertEquals("Invalid email address", errorMessage.getText());
}
}
128 | P a g e
Software Testing (4360706)
Sr. Equipment/
Specification
No Software Resources
.
1 Computer System Computer system with operating system: Windows
7 or higher Ver.,macOS, and Linux, with 4GB or
higher RAM
2 Software Microsoft office or any Open-source spreadsheet
package.
3 Code Editors and Tools CODE Editor (Notepad++, VS Code, Sublime), JAVA
IDE (Eclipse, NetBeans, IntelliJ)
4 Browser Microsoft Edge, Google Chrome etc
I. Implementation:
Note: Students have to design or take registration page in which at least
various 6 to 8 elements of html tags including various css property to perform
this practical.
129 | P a g e
Software Testing (4360706)
130 | P a g e
Software Testing (4360706)
131 | P a g e
Software Testing (4360706)
1. https://www.javatpoint.com/selenium-webdriver-locating-strategies
2. https://www.browserstack.com/guide/run-selenium-tests-using-selenium-
chromedriver
3. https://www.guru99.com/junit-annotations-api.html
4. https://www.tutorialspoint.com/junit/junit_using_assertion.htm
L. Assessment-Rubrics
Total /25
132 | P a g e
Software Testing (4360706)
Practical No.13 Design and run test script for a Login page and home page using
Selenium tool and TestNG.
This practical is expect to develop the following skills in you apply types, levels
and methods of software testing on applications.
1. Identify system with its specification and get familiar with the system.
2. Use the different software testing concepts.
3. Ability to write system specification of the systems.
4. Ability to design test case for given systems.
133 | P a g e
Software Testing (4360706)
Utilize popular testing tools (e.g., Selenium, JUnit, TestNG) for creatingand
executing automated test scripts.
E. Practical Outcome (PRo)
134 | P a g e
Software Testing (4360706)
1. @Test:
Purpose: Marks a method as a test method.
135 | P a g e
Software Testing (4360706)
2. @BeforeMethod:
Purpose: Executes code before each test method.
Usage: Used to set up preconditions or resources required for each test.
Example:
java code
136 | P a g e
Software Testing (4360706)
137 | P a g e
Software Testing (4360706)
java code
@Test(dataProvider = "data") public void testDataDriven(String input) {
// Test logic using the provided data } @DataProvider(name = "data")
public Object[][] testData() { // Provide test data as a 2D array return
new Object[][] {{"data1"}, {"data2"}}; }
9. @Parameters:
Purpose: Pass parameters to a test method from the XML configuration
file.
Usage: Used to inject external parameters into test methods.
Example:
java code
@Test @Parameters("paramValue") public void
testWithParameter(String paramValue) { // Test logic using the
parameter value }
10. @Listeners:
Purpose: Specifies the listeners for a test class.
Usage: Used to attach listeners for customizing test execution.
Example:
java code
@Listeners(MyTestListener.class) public class MyTestClass { // Test
methods and other annotations }
These annotations provide a flexible and powerful way to define the testing
lifecycle and behavior in TestNG. They allow developers to customize the test
execution flow and handle various aspects of test setup, execution, and teardown.
Overall, TestNG is a powerful testing framework that is widely used in the Java
development community for unit testing, integration testing, and end-to-end testing
of applications. It provides a rich set of features that cater to the diverse needs of
software testing.
Below is an example of a simple Selenium WebDriver script with TestNG
annotations. This example navigates to the Google homepage, performs a search,
and asserts that the title of the search results page contains the expected text.
java code
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
138 | P a g e
Software Testing (4360706)
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
public class GoogleSearchTest
{ private WebDriver driver;
private String baseUrl = "https://www.google.com/";
@BeforeClass
public void setUp() {
// Set the path to the ChromeDriver executable
System.setProperty("webdriver.chrome.driver", "path/to/chromedriver");
@Test
public void testGoogleSearch() {
// Find the search input field using its name attribute
WebElementsearchBox = driver.findElement(By.name("q"));
// Enter the search query
searchBox.sendKeys("TestNG with Selenium");
139 | P a g e
Software Testing (4360706)
1. @BeforeClass:
This TestNG annotation is used for setup activities that need to be
performed before any test method in the class.
In this example, it sets up the ChromeDriver and navigates to the Google
homepage.
2. @Test:
This TestNG annotation marks a method as a test method.
In this example, the testGoogleSearch method performs a search on
Google and asserts that the search results page title contains the
expected text.
3. @AfterClass:
This TestNG annotation is used for cleanup activities that need to be
performed after all test methods in the class have run.
In this example, it closes the browser window.
140 | P a g e
Software Testing (4360706)
To run this script, you'll need to have the Selenium WebDriver library
and the ChromeDriver executable set up in your project. Adjust the path
to the ChromeDriver executable accordingly.
H. Resources/Equipment Required
Sr.No. Equipment/
Specification
Software
Resources
1 Computer System Computer system with operating system: Windows
7 or higher Ver.,macOS, and Linux, with 4GB or
higher RAM
2 Software Microsoft office or any Open-source spreadsheet
package.
3 Code Editors and CODE Editor (Notepad++, VS Code, Sublime), JAVA
Tools IDE (Eclipse, NetBeans, IntelliJ)
4 Browser Microsoft Edge, Google Chrome etc
I. Practical Implementation:
141 | P a g e
Software Testing (4360706)
142 | P a g e
Software Testing (4360706)
143 | P a g e
Software Testing (4360706)
K. References Links
1. TestNG Tutorial: What is Annotations & Framework in Selenium (guru99.com)
2. TestNG Tutorial - Javatpoint
3. TestNG Tutorial (tutorialspoint.com)
4. TestNG Tutorial: Introduction to TestNG Framework (softwaretestinghelp.com)
L. Assessment-Rubrics
144 | P a g e