STA - UNIT I Mar 1
STA - UNIT I Mar 1
UNIT I
FOUNDATIONS OF SOFTWARE TESTING
Why do we test Software?, Black-Box Testing and White-Box Testing, Software Testing
Life Cycle, V-model of Software Testing, Program Correctness and Verification,
Reliability versus Safety, Failures, Errors and Faults (Defects), Software Testing
Principles, Program Inspections, Stages of Testing: Unit Testing, Integration Testing,
System Testing
1.1 INTRODUCTION
Software testing is a method for finding out if the software meets requirements
and is error-free. It involves running software or system components manually or
automatically in order to evaluate one or more characteristics. Finding faults, unfulfilled
requirements in comparison to the documented specifications is the aim of software testing.
Some prefer to use the terms white box and black box testing to describe the
concept of software testing. To put it simply, software testing is the process of
validating an application that is being tested.
The intended audience's adoption of the software, its user-friendly graphical user
interface, its robust functionality load test, etc., is all factors in its success. For instance, the
target „market for banking and a video game are very different. As a result, an organization
can determine if a software product it produces will be useful to its customers and other
audience members.
1.1.3 : Why Software Testing is Important? (What is the need of Software Testing?)
Software testing is a method for finding out if the software meets requirements
and is error-free Software testing is a very expensive and critical activity; but releasing the
software without testing is definitely more expensive and dangerous. We shall try to find
more errors in the early phases of software development. The cost of removal of such errors
will be very reasonable as compared to those errors which we may find in the later phases of
software development. The cost to fix errors increases drastically from the specification
phase to the test phase and finally to the maintenance phase as shown in Figure 1.1.
If an error is found and fixed in the specification and analysis phase, it hardly costs anything.
We may term this as “1 unit of cost” for fixing an error during specifications and analysis
phase. The same error, if propagated to design, may cost 10 units and if, further propagated
to coding, may cost 100 units. If it is detected and fixed during the testing phase, it may lead
to 1000 units of cost. If it could not be detected even during testing and is found by the
customer after release, the cost becomes very high. We may not be able to predict the cost of
failure for a life critical system’s software. The world has seen many failures and these
failures have been costly to the software companies.
The fact is that we are releasing software that is full of errors, even after doing
sufficient testing. No software would ever be released by its developers if they are asked to
certify that the software is free of errors. Testing, therefore, continues to the point where it is
considered that the cost of testing processes significantly outweighs the returns.
Manual testing can be further divided into three types of testing, which are as
follows:
White box testing
Black box testing
Grey box testing.
2. Automation testing:
Automation testing is a process of converting any manual test cases into the test scripts
with the help of automation tools or any programming language. With the help of
automation testing, we can enhance the speed of our test execution because here, we do not
require any human efforts.
Manual Testing Vs Automation Testing
Manual Testing Automation Testing
In manual testing, the test cases are executed In automated testing, the test cases are
by the human tester. executed by the software tools.
Automation testing is faster than manual
Manual testing is time-consuming.
testing.
Automation testing takes up automation tools
Manual testing takes up human resources.
and trained employees.
Exploratory testing is possible in manual Exploratory testing is not possible in
testing. automation testing.
Initial Investment is less Initial Investment is more
Advantages:
1. Testers do not require technical knowledge, programming of IT skills.
2. Testers do not need to learn implementation details of the system
3. Tests can be executed by outsourced testers.
4. Low chance of false positives.
5. Tests have lower complexity, since they simply model common user behavior
Dis-Advantages:
1. Difficult to automate.
2. Requires prioritization, typically infeasible to tests all user paths.
3. Difficult to calculate test coverage.
4. If a test fails, it can be difficult to understand the root cause of the issues.
5. Tests may be conducted at low scale or on a non-production like environment
1.2.4 Differences between Black Box Testing , Gray Box and White Box Testing:
Black Box testing provides Gray Box testing does not White Box testing does not
resilience and security against provide resilience and security provide resilience and security
viral attacks. against viral attacks. against viral attacks.
Phases of STLC:
1. Requirement Analysis: Requirement Analysis is the first step of the Software Testing
Life Cycle (STLC). In this phase quality assurance team understands the requirements like
what is to be tested. If anything is missing or not understandable then the quality assurance
team meets with the stakeholders to better understand the detailed knowledge of
requirements.
The activities that take place during the Requirement Analysis stage include:
• Reviewing the software requirements document (SRD) and other related documents
• Interviewing stakeholders to gather additional information
• Identifying any ambiguities or inconsistencies in the requirements
• Identifying any missing or incomplete requirements
• Identifying any potential risks or issues that may impact the testing process
• Creating a requirement traceability matrix (RTM) to map requirements to test
cases
At the end of this stage, the testing team should have a clear understanding of the
software requirements and should have identified any potential issues that may impact the
testing process. This will help to ensure that the testing process is focused on the most
important areas of the software and that the testing team is able to deliver high-quality
results.
2. Test Planning: Test Planning is the most efficient phase of the software testing life cycle
where all testing plans are defined. In this phase, manager of the testing team calculates the
estimated effort and cost for the testing work. This phase gets started once the requirement-
gathering phase is completed.
The activities that take place during the Test Planning stage include:
• Identifying the testing objectives and scope
• Developing a test strategy: selecting the testing methods and techniques
• Identifying the testing environment and resources needed
• Identifying the test cases that will be executed and the test data that will be used
• Estimating the time and cost required for testing
• Identifying the test deliverables and milestones
• Assigning roles and responsibilities to the testing team
• Reviewing and approving the test plan
At the end of this stage, the testing team should have a detailed plan for the testing activities
that will be performed, and a clear understanding of the testing objectives, scope, and
deliverables. This will help to ensure that the testing process is well-organized and that the
testing team is able to deliver high-quality results.
3. Test Case Development: The test case development phase gets started once the test
planning phase is completed. In this phase testing team notes down the detailed test cases.
The testing team also prepares the required test data for the testing. When the test cases are
prepared then they are reviewed by the quality assurance team.
The activities that take place during the Test Case Development stage include:
• Identifying the test cases that will be developed
• Writing test cases that are clear, concise, and easy to understand
• Creating test data and test scenarios that will be used in the test cases
• Identifying the expected results for each test case
• Reviewing and validating the test cases
• Updating the requirement traceability matrix (RTM) to map requirements to test
cases
At the end of this stage, the testing team should have a set of comprehensive and
accurate test cases that provide adequate coverage of the software or application. This will
help to ensure that the testing process is thorough and that any potential issues are identified
and addressed before the software is released.
4. Test Environment Setup: Test environment setup is a vital part of the STLC. Basically,
the test environment decides the conditions on which software is 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 customer creates the testing environment.
5. Test Execution: After the test case development and test environment setup test execution
phase gets started. In this phase testing team starts executing test cases based on prepared test
cases in the earlier step.
The activities that take place during the test execution stage of the Software Testing
Life Cycle (STLC) include:
• Test execution: The test cases and scripts created in the test design stage are run
against the software application to identify any defects or issues.
• Defect logging: Any defects or issues that are found during test execution are
logged in a defect tracking system, along with details such as the severity, priority, and
6. Test Closure: Test closure is the final stage of the Software Testing Life Cycle (STLC)
where all testing-related activities are completed and documented. The main objective of the
test closure stage is to ensure that all testing-related activities have been completed and that
the software is ready for release.
At the end of the test closure stage, the testing team should have a clear
understanding of the software’s quality and reliability, and any defects or issues that were
identified during testing should have been resolved. The test closure stage also includes
documenting the testing process and any lessons learned so that they can be used to improve
future testing processes
Test closure is the final stage of the Software Testing Life Cycle (STLC) where all
testing-related activities are completed and documented. The main activities that take place
during the test closure stage include:
• Test summary report: A report is created that summarizes the overall testing
process, including the number of test cases executed, the number of defects found, and the
overall pass/fail rate.
• Defect tracking: All defects that were identified during testing are tracked and
managed until they are resolved.
• Test environment clean-up: The test environment is cleaned up, and all test data
and test artifacts are archived.
• Test closure report: A report is created that documents all the testing-related
activities that took place, including the testing objectives, scope, schedule, and resources
used.
• Knowledge transfer: Knowledge about the software and testing process is shared
with the rest of the team and any stakeholders who may need to maintain or support the
software in the future.
• Feedback and improvements: Feedback from the testing process is collected and
used to improve future testing processes
specified requirements are met. Verification ensures that we build the product right.
Validation: It involves dynamic analysis method (functional, non-functional), testing
is done by executing code. Validation is the process to check the software after the
completion of the development process to determine whether the software meets the
customer expectations and requirements. Validation ensures that we build the right product.
So V-Model contains Verification phases on one side of the Validation phases on the
other side. Verification and Validation process is joined by coding phase in V-shape. Thus it
is known as V-Model.
Verification
Phase
Validation
phase
1. Business requirement analysis: This is the first step where product requirements
are understood from the customer's side. This phase contains detailed communication to
understand customer's expectations and exact requirements.
2. System Design: In this stage system engineers analyze and interpret the business
of the proposed system by studying the user requirements document.
3. Architecture Design: The baseline in selecting the architecture is that it should
understand all which typically consists of the list of modules, brief functionality of each
module, their interface relationships, dependencies, database tables, architecture diagrams,
technology detail, etc. The integration testing model is carried out in a particular phase.
4. Module Design: In the module design phase, the system breaks down into small
modules. The detailed design of the modules is specified, which is known as Low-Level
Design
5. Coding Phase: After designing, the coding phase is started. Based on the
requirements, a suitable programming language is decided. There are some guidelines and
standards for coding. Before checking in the repository, the final build is optimized for better
performance, and the code goes through many code reviews to check the performance.
Program Correctness
Following the preceding discussion, we base our notion of Programs correctness b y
co nsider ing two variants:
• Pairs of initialize-Check-statements in program fragments and tests. These are
executable and can be evaluated during verfication.
• Pairs of assume-assert-statements in program fragments and tests. These are
executable and can be evaluated at run-time.
We call the first component, initialize, assume-statement as a pre-condition. We call
its second component, check , assert-statement a post- condition.
Program Verification
To demonstrate that a program is correct we verify it. We consider two principles
methods for verifying programs.
Proof
Using logical deduction, we show that any execution of a program starting in a
state satisfying the pre-condition, it terminates in a state satisfying its post-condition. In
other words, we show that the program is correct.
Testing
Executing a program for specific states satisfying the pre-condition, we check
whether on termination a state is reached that satisfies the post-condition. It is up to us to
determine suitable pairs of states, called test cases. This approach does not show that a
program is correct. In practice, we guess that programs that have been subjected to a
sufficient number of tests is correct. This kind of reasoning is called induction: from a
collection of tests that confirm correctness for precisely those tests, we infer that this is
the case for possible tests. Testing is a validation method: it is entirely possible that all
tests that we have provided appear to confirm correctness, but later we find a test case
that refutes the conclusion. Either the program contains an error or the test case is wrong.
Verification Vs Validation
Verification Validation
Verification refers to the set of activities that Validation refers to the set of activities that ensure
ensure software correctly implements the specific that the software that has been built is traceable to
function customer requirements.
It includes checking documents, designs, codes It includes testing and validating the actual product.
Verification is the static testing. Validation is dynamic testing.
Methods used in verification are Methods used in validation are Black Box
reviews, walkthroughs, inspections and desk- Testing, White Box Testing and non-functional
checking. testing
It checks whether the software meets the
It checks whether the software conforms to
requirements and expectations of a customer or
specifications or not.
not.
Verification means Are we building the product Validation means Are we building the right
right ? product?
Safety-critical software
Safety-critical software is very different from both non-critical software and safety-
critical hardware. The difference lies in the massive testing program that such software
undergoes.
Defect:
A defect refers to a situation when the application is not working as per the requirement and the
actual and expected result of the application or software is not in sync with each other.
The defect is an issue in application coding that can affect the whole program.
It represents the efficiency and inability of the application to meet the criteria and prevent
the software from performing the desired work.
The defect can arise when a developer makes major or minor mistakes during the
development phase.
Error
Error is a situation that happens when the Development team or the developer fails to
understand a requirement definition and hence that misunderstanding gets translated into buggy
code. This situation is referred to as an Error and is mainly a term coined by the developers.
Errors are generated due to wrong logic, syntax, or loop that can impact the end-user
experience.
It is calculated by differentiating between the expected results and the actual results.
It raises due to several reasons like design issues, coding issues, or system specification
issues and leads to issues in the application.
Fault:
Sometimes due to certain factors such as Lack of resources or not following proper steps, Fault
occurs in software which means that the logic was not incorporated to handle the errors in the
application. This is an undesirable situation, but it mainly happens due to invalid documented
steps or a lack of data definitions.
It is an unintended behavior by an application program.
It causes a warning in the program.
If a fault is left untreated it may lead to failure in the working of the deployed code.
A minor fault in some cases may lead to high-end error.
There are several ways to prevent faults like adopting programming techniques,
development methodologies, peer review, and code analysis.
Failure:
Failure is the accumulation of several defects that ultimately lead to Software failure and results
in the loss of information in critical modules thereby making the system unresponsive. A failure
is the result of execution of a fault and is dynamic in nature. Generally, such situations happen
very rarely because before releasing a product all possible scenarios and test cases for the code
are simulated. Failure is detected by end-users once they face a particular issue in the software.
Failure can happen due to human errors or can also be caused intentionally in the system by
an individual.
The Fault is a
The Defect is An Error is a
state that causes A failure is the
the difference mistake made in
It is an informal the software to result of execution
between the the code; so that
name specified fail to of a fault and is
actual outcomes we cannot dynamic in
to the defect. accomplish its
and expected execute or nature.
essential
outputs. compile code.
function.
• The application will be put through testing by the test engineer to ensure that there
are no bugs or flaws. We can only pinpoint the existence of problems in the application or
program when testing. The main goal of testing is to find any flaws that might prevent the
product from fulfilling the client's needs by using a variety of methods and testing
techniques. Since the entire test should be able to be traced back to the customer
requirement.
• Testing reduces the amount of flaws in any program, but this does not imply that the
application is defect-free since sometimes software seems to be bug-free despite extensive
testing. But if the end-user runs into flaws that weren't discovered during testing, it's at the
point of deployment on the production server.
It might often appear quite difficult to test all the modules and their features
throughout the real testing process using effective and ineffective combinations of the input
data. Therefore, because it requires endless decisions and the majority of the hard labour is
unsuccessful. Extensive testing is preferred instead. As a result, we may finish this sort of
variation in accordance with the significance of the modules.
3. Early testing:
• Here, early testing refers to the idea that all testing activities should begin in the
early stages of the requirement analysis stage of the software development life cycle in order
to identify the defects. If we find the bugs at an early stage, we can fix them right away,
which could end up costing us much less than if they are discovered in a later phase of the
testing process.
• Since we will need the requirement definition papers in order to conduct testing, if
the requirements are mistakenly specified now, they may be corrected later, perhaps during
the development process.
4. Defect clustering:
• The defect clustering specified that we can identify the quantities of problems that
are associated to a limited number of modules during the testing procedure: We have a
number of explanations for this, including the possibility of intricate modules, difficult code
and more.
• According to the pareto principle, which suggests that we may determine that
approximately, these kinds of software or applications will follow, roughly? Twenty percent
of the modules contain eighty percent of the complexity. This allows us to locate the
ambiguous modules, but it has limitations if the same tests are run often since they will not
be able to spot any newly introduced flaws.
This is based on the theory that when you use pesticide repeatedly on crops, insects
will eventually build up an immunity, rendering it ineffective. Similarly, with testing, if the
same tests are run continuously then – while they might confirm the software is working –
eventually they will fail to find new issues. It is important to keep reviewing your tests and
modifying or adding to your scenarios to help prevent the pesticide paradox from occurring –
maybe using varying methods of testing techniques, methods and approaches in parallel.
Testing is ALL about the context. The methods and types of testing carried out can
completely depend on the context of the software or systems – for example, an e-commerce
website can require different types of testing and approaches to an API application, or a
database reporting application. What you are testing will always affect your approach.
If your software or system is unusable (or does not fulfill users‟ wishes) then it does
not matter how many defects are found and fixed – it is still unusable. So in this sense, it is
irrelevant how issue- or error-free your system is; if the usability is so poor that users are
unable to navigate, or/and it does not match business requirements then it has failed, despite
having few bugs.
It is important, therefore, to run tests that are relevant to the system’s requirements.
You should also be testing your software with users – this can be done against early
prototypes (at the usability testing phase), to gather feedback that can be used to ensure and
improve usability. Remember, just because there might be a low number of issues, it does not
mean your software is shippable – meeting client expectations and requirements are just as
important as ensuring quality.
1. Planning
The planning phase starts with the selection of a group review team. A moderator
plans the activities performed during the inspection and verifies that the software entry
criteria are met.
3. Preparation
In the individual preparation phase, the inspector collects all the materials needed for
inspection. Each reviewer studies the project individually and notes the issues they
encounter.
4. Meeting
The moderator conducts the meeting to collect and review defects. Here, the reader
reads through the product line by line while the inspector points out the flaws. All issues are
raised, and suggestions may be recorded.
5. Rework
Based on meeting notes, the author changes the work product.
6. Follow-up
In the last phase, the moderator verifies if necessary changes are made to the software
product, compiling a defect summary report.
The life cycle of a unit test is to plan, implement, review and maintain
1. Review the code written:. According to the unit test life cycle, you first outline the
requirements of your code and then attempt to create a test case for each of them. You
review the code written.
2. Check in code from repository : The reviewed unit is put into the repository for further
testing
3. Check out code from repository : Select the Unit for which the testing has to be done
4. Make suitable changes: When the time comes, make suitable changes to the unit, after
analyzing each function or method . This will give the tester insight into what is going
on in that piece of code. Here is an example:
Parameters being passed in
Code doing its job
Code returning something
5. Execute the test and compare the expected and actual results: This phase of the Unit
testing life cycle involves developing a test by creating a test object, selecting input
values to execute the test, executing the test, and comparing the expected and actual
results
6. Fix the detected bugs in the code: It also gives developers peace of mind when adding
or modifying code because they know if they break something, they will be notified
immediately during testing. This way, you can fix problems before they ever reach
production and cause issues for end users
Re-execute the tests to verify them: Unit testing is a great way for developers to keep
track of their changes, which can be especially important when it comes to life cycle
methods that may not have a visual representation. Re-executing the tests to verify them
after each change can help ensure everything is still working as expected.
Stress testing: Stress testing is a sort of software testing carried out to examine the
system's resilience under changing loads.