Module II
Module II
Module II
Software Testing
• Testing is the process of evaluating a system or its
component(s) with the intent to find that whether it satisfies
the specified requirements or not.
• This activity results in the actual, expected and difference
between their results.
• In simple words testing is executing a system in order to
identify any gaps, errors or missing requirements in contrary
to the actual desire or requirements.
• According to ANSI/IEEE 1059 standard, Testing can be
defined as “A process of analyzing a software item to
detect the differences between existing and required
conditions (that is defects/errors/bugs) and to evaluate
the features of the software item”.
Who does testing?
• It depends on the process and the associated stakeholders of the project(s).
• In the IT industry, large companies have a team with responsibilities to evaluate the developed
software in the context of the given requirements.
• Moreover, developers also conduct testing which is called Unit Testing.
• In most cases, following professionals are involved in testing of a system within their respective
capacities:
Software Tester
Software Developer
Project Lead/Manager
End User
• Different companies have difference designations for people who
test the software on the basis of their experience and knowledge
such as Software Tester, Software Quality Assurance Engineer,
and QA Analyst etc.
When to Start Testing
• An early start to testing reduces the cost, time to rework and error free software
• However, in Software Development Life Cycle (SDLC) testing can be started from
the Requirements Gathering phase and lasts till the deployment of the software.
• It also depends on the development model that is being used. For example, in
Water fall model formal testing is conducted in the Testing phase, but in
• Reviewing the design in the design phase with intent to improve the
design is also considered as testing.
Verification Validation
Are you building it right? Are you building the right thing?
Ensure that the software system meets all the Ensure that functionalities meet the intended
functionality. behavior.
Verification takes place first and includes the Validation occurs after verification and mainly
checking for documentation, code etc. involves the checking of the overall product.
Done by developers. Done by Testers
Have static activities as it includes the Have dynamic activities as it includes
reviews, walkthroughs, and inspections to executing the software against the
verify that software is correct or not. requirements.
It is an objective process and no subjective It is a subjective process and involves
decision should be needed to verify the subjective decisions on how well the
Software. Software works.
Difference between Testing, Quality Assurance and Quality Control
Difference between Audit and Inspection
• In black box testing, we don’t have access to the internal coding, and there is no
need to understand the coding. But in white box testing, we must work with the
internal coding, structure, and algorithm.
• Grey box testing is where these two merges and the tester has partial knowledge
of the internal details of your systems and the outer details as per the
requirements.
• Improved test coverage: You have to perform this testing both through the
aspect of developers and testers. Hence it will earn more test coverage and
thereby improves your product quality.
• Limited access to internal code: You don’t need to understand the entire
internal structure and algorithm for this testing. Thus, there will be limited
access to the internal coding of the system, and sometimes it becomes
difficult to find out the root causes of the defects.
• Dependency on system knowledge: For this kind of testing, there is no
necessity to know the thorough implementation of the system. So, it
indicates a need for more knowledge of the testers about the system. Thus
testers may need help to create test cases for complex systems.
Black-box testing Techniques
• Specifically, this testing approach focuses on the input that goes into the
software and the output that is produced to see whether the expected
results are achieved.
• To better explain how this works, let’s look at a simple example.
• Let’s say we want to test the Calculator application on our phone. We
open the application, enter the numbers we want to calculate as well as
the operator and equal sign, and wait for the output.
• Another example would be testing a social application. Black box testing
in this case would be inputting a username and password, while the
expected output would be getting logged into the application. In both
examples, we input information and wait for the output without looking
at the code.
Equivalence partitioning (EP)
• Equivalence partitioning is a technique that divides test objects into partitions or classes that are
treated and tested in the same way.
• This technique is used for testing a range of values, inputs, and outputs.
• Valid equivalence partitions contain only the valid values that are accepted by the testing object.
• In contrast, invalid equivalence partitions contain only invalid values that are rejected by the testing
object.
• When using this technique to design test cases, there are several important things that you need to
remember.
• First of all, every single value belongs only to one of the partitions. Secondly, you
must always test valid and invalid partitions. Finally, you must test invalid partitions
individually because otherwise, they will mask the results. If there is a need, you can
divide the partitions into sub-partitions.
• To achieve 100% coverage of the testing object with this technique, you must test at
least one representative member from each partition. You can do that by taking one
value from each defined valid and invalid partition. You will not increase coverage by
testing two values from the same partition.
Example of equivalence partitioning:
• In this scenario, we can identify three valid partitions and one invalid
partition for the amount under $100.
• To apply equivalence partitioning, we can take one value from
each partition: $140 from the first valid partition, $370 from
the second valid partition, $530 from the third valid partition,
and $78 from the invalid partition.
• Now we have four test cases and have achieved 100% coverage
because all defined partitions are covered.
Boundary value analysis (BVA)
• This technique is an extension of equivalence partitioning and is used to test the boundaries
of the valid and invalid partitions.
• These boundaries are breaking points that are most likely to be incorrect.
• Also, both these black box testing techniques—equivalence partitioning and boundary value
analysis—can be combined.
• There are two types of boundary value analysis, two-value and three-value boundary
analysis. We use two-value boundary analysis to test the minimum and maximum values of
the boundary. In comparison, we use three-value boundary analysis to test the values
before the boundary, at the boundary, and just above the boundary.
Example of two-value boundary
analysis:
• The discount is calculated based on the total amount of the shopping cart.
If the total amount is in the range of $100–$200, the discount is 10%. If the
total amount is in the range of $201–$500, the discount is 20%. If the total
amount is more than $500, the discount is 30%.
• With this technique, we identify the conditions and the resulting actions of
the testing object and present them in a table.
Example of decision table testing:
• Often conditions are the inputs, usually at the top, and actions are the
outputs, usually defined at the bottom of the table.
• If the total amount is more than $200 and the customer is a member, the discount is 10%.
• If the customer is not a member, there is no discount regardless of the total amount in the
shopping cart.
• To use the decision table testing technique, we first need to identify the conditions. In this case,
the conditions are the total amount in the shopping cart and whether a customer is a member or
not. Next, we need to identify all combinations of these conditions. We will mark them with Y
and N.
The next step is to identify the correct actions/outcomes for each combination. We will
use Y and N to mark them.
State transition testing
• State transition testing is a black box testing technique that is used when a system
responds differently to the same input and depends on current conditions and
previous history.
• The previous history of the system is called the state, while an event is an
occurrence that can result in a transition.
• After shopping, we put the receipt in the parking machine that calculates whether we get a
coupon for free parking.
• To get a coupon, the receipt must be in good condition and have an amount that is equal to
or greater than $200.
• First, the machine checks if the receipt is damaged. If the receipt is damaged, the machine
will reject it.
• If the receipt is not damaged, the machine checks if the total amount is equal to or greater
than $200.
• If the total amount is under $200, the receipt will be rejected. If the total amount is equal to
or greater than $200, we will get a coupon for free parking.
In this example, we have three test cases for state coverage and also three test cases for
transition coverage:
Test case 1: Enter the receipt > Receipt is damaged > Receipt is rejected.
Test case 2: Enter the receipt > Receipt is not damaged > Receipt is < $200 > Receipt is
rejected.
Test case 3: Enter the receipt > Receipt is not damaged > Total amount is => $200 > Get
coupon.
Error Guessing
• By testing these values, you can identify whether the system correctly accepts valid deposits. You can also
determine if it properly rejects and shows error messages on amounts outside the acceptable range.
White Box Testing With an Example
• Structural Testing
• Code-Based Testing
White Box Testing is a software testing process that includes studying an application’s core
structure and logic. It is carried out at the code level, where the tester has access to the source
code and is knowledgeable of the internal implementation of the product.
Example
Let’s consider a simple example of white box testing for a function that
calculates the area of a rectangle:
def calculate_rectangle_area(length, width):
if length <= 0 or width <= 0:
return “Invalid input: Length and width must be positive numbers.”
else:
area = length * width
return area
Now, let’s create some test cases to perform
white box testing on this function:
So, the statement coverage technique covers dead code, unused code, and
branches.
Branch Coverage Testing
• Branch coverage technique is used to cover all branches of the control flow graph.
• It covers all the possible outcomes (true and false) of each condition of decision point at least
once.
• Branch coverage technique is a white box testing technique that ensures that every branch of
each decision point must be executed.
• However, branch coverage technique and decision coverage technique are very similar, but
there is a key difference between the two. Decision coverage technique covers all branches of
each decision point whereas branch testing covers all branches of every decision point of the
code.
• Like decision coverage, it also uses a control flow graph to
calculate the number of branches.
How to calculate Branch coverage?
• The control structure of a program is used to develop a test case for the program. In this
technique, a particular part of a large program is selected by the tester to set the testing
path. It is mostly used in unit testing. Test cases represented by the control graph of the
program.
• Control Flow Graph is formed from the node, edge, decision node, junction node to
specify all possible execution path.
Example
Diagram- Control Flow Graph
• The above example shows eligibility criteria of age for voting where if
age is 18 or more than 18 so print message "You are eligible for voting"
if it is less than 18 then print "You are not eligible for voting."
• Program for this scenario is written above, and the control flow graph
is designed for the testing purpose.
• In the control flow graph, start, age, eligible, not eligible and stop are
the nodes, n>=18 is a decision node to decide which part (if or else) will
execute as per the given value. Connectivity of the eligible node and
not eligible node is there on the stop node.
• Test cases are designed through the flow graph of the programs to
determine the execution path is correct or not. All nodes, junction,
edges, and decision are the essential parts to design test cases.
Decision Coverage Testing
• Decision coverage technique comes under white box testing which gives
decision coverage to Boolean values. This technique reports true and false
outcomes of Boolean expressions. Whenever there is a possibility of two or
more outcomes from the statements like do while statement, if statement
and case statement (Control flow statements), it is considered as decision
point because there are two outcomes either true or false.
• Decision coverage covers all possible outcomes of each and every Boolean
condition of the code by using control flow graph or chart.
• In this technique, it is tough to get 100% coverage because
=100/2
= 50
Decision Coverage = 50%
Result table of Decision Coverage:
Stress Testing
• The stress testing includes the testing beyond standard operational size, repeatedly to a breaking point,
to get the outputs.
• It highlights the error handling and robustness under a heavy load instead of correct behavior under
regular conditions.
• In other words, we can say that Stress testing is used to verify the constancy and
• dependability of the system and also make sure that the system would not crash under disaster
circumstances.
• To analyses how the system works under extreme conditions, we perform stress testing outside the
normal load.
Objective of Stress Testing
• The primary purpose of executing the stress testing is to confirm that the software does not crash in
lacking computational resources like disk space, memory, and network request.
• The implementation of stress testing certifies that the system fails and improves effortlessly, known
as the recoverability process.
• We can use stress testing to discover hardware issues, data corruption issues.
• Stress testing will help us to identify the security weaknesses that might sneak-in throughout
constant peak load.
• It helps determine the software application's data integrity throughout the extreme load, which
implies that the data should be in a dependable state after a failure.
Why do we need to perform the Stress
Testing?
We need to perform stress testing if we encounter the following situations:
• Whenever e-commerce or online shopping sites announce a sale during
the festival may witness a spike in traffic. Or when an article is mentioned
in a top newspaper, its knowledges an unexpected flow in traffic.
• If we fail to assist this sudden traffic can result in loss of profits and status.
So, in that case, we need to execute the Stress Testing to integrate such
irregular traffic spikes.
• Stress testing is also needed to be performed for the below scenarios:
• When the system is under stress, it should display a proper error message.
• If the system is failed under risky situations could result in huge profits loss.
• Therefore, the execution of stress testing helps identify the failure of the
application and evaluate the performance and recoverability when the
ultimate load occurs in a short duration or when the result is out.
Performance Testing
1. The load testing is carried out for normal and extreme load conditions.
2. Load testing is a type of performance testing that simulates a real-world load on a system or
application to see how it performs under stress.
3. The goal of load testing is to identify bottlenecks and determine the maximum number of
users or transactions the system can handle.
4. It is an important aspect of software testing as it helps ensure that the system can handle
the expected usage levels and identify any potential issues before the system is deployed to
production.
• During load testing, various scenarios are simulated to test
the system’s behavior under different load conditions. This
can include simulating a high number of concurrent users,
simulating numerous requests, and simulating heavy
network traffic. The system’s performance is then measured
and analyzed to identify any bottlenecks or issues that may
occur.
Scalability Testing
Alpha Testing
Alpha testing is an initial phase of software
testing where a group of internal testers
assesses the software for defects before it is
released to external users.
Alpha testing simulates end-users actions to
verify software behavior under real-life
conditions.
Beta Testing
Beta testing involves releasing the software to
a limited group of external users to gather
real-world feedback and identify potential
issues before a wider release.
It is often pre-release, involves a limited
number of end users (beta testers) verifying
software compatibility, providing feedback on
usability, and detecting bugs.
Gamma Testing
Gamma testing, also known as “Release
candidate testing,” is conducted after Beta
Testing. It is concentrated on security and
functionality and is conducted without in-house
QA activities. Only a limited number of users
participate.
Gamma testing focuses on ensuring the product
is ready for a broader audience.
Test cases
Test Case: A set of conditions or variables under which a tester determines whether a system, software
application, or one of its features is working as expected. Each test case is a specific scenario that the
software must handle, often including:
• Preconditions: Any setup or conditions that must be met before the test can be executed.
• Test Steps: The specific actions that need to be performed to carry out the test.
• Pass/Fail Criteria: Determines whether the test case has passed or failed.
Example Test Case
• Test Case ID: TC001
• Test Steps:
• Enter a valid username.
• Test Suite: A collection of test cases intended to be executed together to test a particular component or system
behavior. Test suites are organized to focus on specific areas of functionality and are used to ensure comprehensive
testing.
• Smoke Test Suite: A minimal set of tests to check the basic functionality of the system.
• Regression Test Suite: A set of tests designed to ensure that new code changes do not adversely affect existing
functionality.
• Functional Test Suite: Contains test cases that verify the functional aspects of a particular feature or module.
• Performance Test Suite: Focuses on the performance aspects such as speed, responsiveness, and stability under
load.
Example Test Suite
• Suite Name: Login Module Test Suite
• Description: Test cases to validate the login functionality of the
application.
• Included Test Cases:
• TC001: Verify login with valid credentials.
• TC002: Verify login with invalid credentials.
• TC003: Verify the behavior when the "Forgot Password" link is clicked.
• TC004: Verify session timeout after inactivity.
TEST PLAN
• A test plan is a document that consists of all future testing-related activities.
• Before starting testing there will be a test manager who will be preparing a
test plan.
• Clarity and Consistency: Test case specifications also make it easier for
all the team members to know what has to be tested and how it has to
be done since the framework for testing is clearly laid down. This is
useful in ensuring that the quality of the software being developed is
consistent between one development cycle and the other.
• Traceability: Test case specifications help to connect the requirements
and test cases. This means that every requirement is associated with a
test case and therefore the functionalities are tested and checked.
• Reusability: Test case specifications can be written down and
documented for future use and this can help in cutting down the
time and costs of testing. They can also be used in similar projects
to improve efficiency.
• Risk Mitigation: This way, possible risks and defects are detected
and reported from the very beginning of the development
process, so that they cannot cause problems in the production
environment.
Software Testing Life Cycle.
tested.
• This is independent activity and can be started along with test case
development.
• In this process, the testing team is not involved. either the developer or the