UNIT - I
FOUNDATIONS OF SOFTWARE TESTING
Why do we test software?
Software testing is a critical process that helps to ensure software products perform to meet
user requirements.
Preventing bugs
Improving performance
Customer satisfaction
Black-Box Testing and White-Box Testing:
Black box testing involves testing a system. A tester provides an input, and observes the output
generated by the system under test.
What are the types of Black-Box Testing?
Black box testing mainly comprises three types of testing:
Functional Testing: It involves testing specific functions or features under test.
Functional testing includes unit testing, integration testing, and user acceptance testing.
Non-functional testing: Non-functional testing includes performance testing, load
testing, , volume testing, and security testing.
1
Regression Testing: It involves testing the new version of software for any regression
or degradation in capabilities. It can be applied to both functional and non-functional
aspects of the software.
What is the Black-Box Testing Techniques?
Testers use different techniques of black box testing based on the requirement
Equivalence partitioning
Boundary value analysis
Decision table testing
State transition testing
Error guessing
Advantages of Black-Box Testing:
It can easily be performed by testers with no technical background or programming
knowledge.
It can start as soon as the functional specification are complete.
Both the testers and developers work independently, so the testing the is balanced.
It helps identify the defects and the early stages of testing.
Disadvantages of Black-Box Testing:
There is a high chance of not achieving any result at the end of the test.
Writing test cases is slow and difficult as identifying all possible inputs in a limited time
becomes challenging.
It is not ideal to use for large and complicated applications as complete test coverage is
not possible.
As it is specification-dependent, building test cases without specifications become
difficult.
What is White-Box testing?
2
White box testing techniques analyze the internal structures used data structures,
internal design, code structure, and the working of the software rather than just the
functionality as in black box testing.
Developers carry it out, before sending the programme to the testing team, who then
conducts black-box testing.
It is also referred to as transparent testing, code-based testing, structural testing, and
clear box testing.
Types of White Box testing in software testing:
White box testing is a type of software testing that examines the internal structure and design of
a program or application. The following are some common types of white box testing:
Unit Testing: Tests individual units or components of the software to ensure they
function as intended.
Integration Testing: Tests the interactions between different units or components of the
software to ensure they work together correctly.
Functional Testing: Tests the functionality of the software to ensure it meets the
requirements and specifications.
Performance Testing: Tests the performance of the software under various loads and
conditions to ensure it meets performance requirements.
Security Testing: Tests the software for vulnerabilities and weaknesses to ensure it is
secure.
Code coverage testing: Measures the percentage of code that is executed during
testing to ensure that all parts of the code are tested.
Regression Testing: Tests the software after changes have been made to ensure that
the changes the changes did not introduce new bugs or issues.
Techniques of White Box Testing:
There are some techniques which is used for white box testing-
Statement Coverage: This testing approach involves going over every statement in the
code to make sure that each one has been run at least once.
Branch Coverage: Is a testing approach in which test cases are created to ensure that
each branch is tested at least once.
Path Coverage: Path coverage in a software testing approach that defines and covers
all potential pathways.
Loop Testing: With the help of this technique, loops and values in both independent
and dependent code are examined. Errors often happen at the start and conclusion of
loops
Basis path testing: Using this methodology, control flow diagrams are created from
code and subsequently calculations are made for cyclometric complexity.
Advantages of White Box Testing:
Complete coverage
Better understanding of the system
Improved code quality
3
Increase efficiency
Early detection of error
Disadvantages of White Box Testing:
This testing is very expensive and time consuming
Redesign of code needs test cases to be written again
Missing functionalities cannot be detected.
This technique can be very complex and at times not realistic.
White-box testing requires a programmer with a high level of knowledge due to the
complexity of the level of testing that needs to be done.
Software Testing Life Cycle:
A testing technique called the Software Testing Life Cycle (STLC) may effectively help you
satisfy software quality requirements. Systematic testing is carried out in stages. Although STLC
and Software Development Life Cycle (SDLC) are sometimes misunderstood. STLC is more
concerned with testing and SDLC is concerned with the whole development process.
What is STLC (Software Testing Life Cycle)?
The term "Software Testing Life Cycle" refers to a testing procedure with particular phases that
must be carried out in a certain order to guarantee that the quality objectives have been
reached. Each step of the STLC process is completed in a planned orderly manner, Goals and
deliverables are vary for each phase. Below are the phases of STLC:
Requirement Phase: Analysis and research the requirements throughout this phase of
the STLC. The scope of the testing is determined at this step.
The planning phase: The initial stage of the testing procedure in real-world
circumstances. The actions and resources that will help us achieve the testing goals are
identified at this phase. We also strive to determine the metrics and the procedure for
collecting and monitoring such indicators during planning.
Analysis step: The requirement document, product hazards, and other test bases are
used to determine the test circumstances. The requirements should be able to be linked
back to the test condition. The determination of the test conditions is influenced by a
number of variables, including:
Testing levels and depth
The product complexity
Project and Product-related risks
The life cycle of software development is included
Test administration
The team's abilities and expertise
The stakeholder’s accessibility
Since the test cases will be produced based on the test condition, these details will prompt the
production of more thorough test cases, which will ultimately enhance the coverage, which is
the most significant benefit for creating the detailed test condition.
Design phase: The duties in this phase include to describe the test condition. To
enhance coverage, divide the test condition into many smaller sub-conditions.
4
Locate and collect the test data
Identify the test environment and set it up
Develop the traceability metrics for requirements
Produce metrics for test coverage
Implementation Phase: The construction of thorough test cases is the main
undertaking in the STLC phase. It is crucial to do a review to confirm the accuracy of the
test cases prior to finalizing them. Don't forget to sign off on the test cases before
beginning the real execution as well.
Execution phase: It is the stage of the software testing life cycle when actual execution
occurs. However, it make sure that your entrance requirement is satisfied before you
begin your execution. Execute the test cases and in the event of any discrepancy, report
the faults.
Conclusion Phase: The exits criteria and reporting are the main topics of this STLC
phase. You may choose whether to send out a daily report or a weekly report, etc.,
depending on your project and the preferences of your stakeholders.
Closure Phase: Verify that the test has been completed. Whether all test scenarios are
run or intentionally mitigated. Verify that no results of severity have been opened.
V-Model of Software Testing:
5
Requirement Analysis: When the project team begins to understand what the customer
want from the project. During the analysis phase, the project team needs to ensure they
can deliver the requirements.
High Level Design (HLD): It is the overall system design, database design. It describes
the relation between various modules and functions of the system.
Low Level Design (LLD): It is component-level design process that follows a step-by-
step refinement process. During the detailed phase the logical and functional design is
done and the design of application structure is developed during the high-level design
phase.
Coding: Once the design is complete, most of the major decisions about the system
have been made. The goal of the coding phase is to translate the design of the system
into code in a given programming language.
Unit Testing: It is a level of Software testing where individual units/components of
software are tested. The purpose is to validate that each unit of the software performs as
designed.
Integration Testing: The purpose of this level of testing is to expose faults in the
interaction between integrated units.
System Testing: It is a black box testing technique performed to evaluate the complete
system in specific requirements. It includes both functional and Non-functional testing.
When we use V-model?
When the requirement is well defined and not ambiguous.
The V-shaped model should be used for small to medium-sized projects where
requirements are clearly defined and fixed.
The V-shaped model should be chosen when sample technical resources are available
with essential technical expertise.
Advantages (Pros) of V-model:
Easy to understand
Testing methods like planning, test designing happens well before coding.
This saves a lot of time. Hence a higher chance of success over the waterfall model.
Avoids the download flow of the defects.
Works well for small plans where requirements are easily understood.
Disadvantages of (Cons) of V-model:
Very rigid and least flexible.
Not good for a complex project
Software is developed during the implementation stage, so no early prototypes of the
software are produced.
6
If any changes happen in the midway, then the test documents along with the required
documents, has to be updated.
Program Correctness and Verifications:
Program Correctness: A program is considered correct if it behaves as expected for all
possible inputs. In other words, a program is correct if it produces the correct output for every
input and matches its specifications.
Verifications: Program verification is a process that ensures that software is built correctly and
meets the requirements.
The goal of software testing is to run the potential programme on a set of input data and
determine it acts according to specification. Software testing includes the study of
correctness since it is only possible to analyze a program's behavior.
It leads to making assumptions about the behavior of the programme at particular points
in its execution and then verifying these assumptions.
A testing technique or a proving method is often rendered useless not by any inherent
quality of the approach by being used incorrectly.
Reliability Versus Safety:
Reliability: It is a software testing process that ensures that a software product is reliable and
bug-free for its intended purpose.
Safety: Safety testing verifies that software is implemented correctly, identifies safety issues,
and ensures that monitoring systems are working properly.
Failures, Errors and Faults (Defects):
Failures: A test failure highlights the deviation between the actual and expected results.
Errors: An error is a mistake a coder makes during the software development process.
Faults (Defects): Defects can be caused by poor design, incorrect data, or unexpected errors.
They can affect the software's functionality, performance, or usability.
7
Software Testing Principles:
Software testing is a process that involves putting software or an application to use in order to
find faults or flaws. There are seven different testing principles.
Testing shows the presence of defects: The goal of testing is to make the software
failure. In case, testers are unable to find defects after repeated regression testing
doesn’t not mean that the software is bug-free.
Exhaustive Testing is Impossible: Testing all the functionalities using all valid and
invalid inputs and preconditions is known as Exhaustive Testing.
Early Testing: Early testing saves time and money. To find error conditions early, both
static [e.g., document reviews] and dynamic testing activities [e.g., Unit Test] should be
started as early as possible in the SDLC.
Defect Clustering: Defect clustering in software testing means that a small module or
functionality contains most of the bugs or it has the most operational failures.
Pesticide Paradox: It is the process of repeating the same test cases again and again
and no longer find new bugs. It is necessary to review the test cases regularly and add
or update them to find more defects.
Testing in Context Dependant: Testing approach depends on the context of the
software we develop. We do test the software differently in different contexts. For
example, online banking application requires a different approach of testing compared to
an e-commerce site.
Absence of Error: 99% of bug free software may still be unusable, if wrong
requirements were incorporated into the software and the software is not addressing the
business needs. The software which we built not only be a 99% bug-free software but
also it must fulfill the business needs otherwise it will become an unusable software.
8
Program Inspections:
Program inspections can refer to a variety of inspections, including
Software Inspection: A common review practice is software projects that involves identifying
defects in work products like software requirements specifications and test plans.
What are the steps of software inspection?
The stages in the inspections process are: Planning, Overview meeting, Preparation, Inspection
meeting, Rework and Follow-up.
Planning: The planning phase starts when the entry criteria for the inspection state are met. A
moderator verifies that the product entry criteria are met.
Overview: In the overview phase, a presentation is given to the inspector with some
background information needed to review the software product properly.
Preparation: This is considered an individual activity. In this part of the process, the inspector
collects all the materials needed for inspection, reviews that material and notes any defects.
Meeting: The moderator conducts the meeting. In the meeting, the defects are collected and
reviewed.
Rework: The author performs this part of the process in response to defect disposition
determined in the meeting.
Follow-up: In follow-up, the moderator makes the correction and then compiles the inspection
management and defects summary report.
Characteristics of Inspection:
An experienced moderator who is not the author generally directs the inspection. The
task of the moderator is to conduct a documents peer review.
Inspection is most formal and is guided by rules and checklists.
Entry and exist criteria are used in this evaluation procedure.
A pre-meeting preparation is necessary
An inspection report is created and sent to the author so they may take the necessary
action.
A formal follow-up procedure is utilized after an inspection to ensure that action is taken
promptly and on schedule.
The purpose of inspection is to bring in improvements to the process, not only to find
problems.
Workplace Inspection: Reduce the risk of occupational and illnesses by identifying unsafe and
unhealthy conditions.
9
Stages of Testing: Unit Testing, Integration
Testing, System Testing:
Unit Testing: Unit Testing is a type of software testing where individual units or
components of a software are tested. Unit testing is done during the development
(coding phase) of an application by the developers. In SDLC, Unit testing is first level of
testing done before integration testing. Unit testing is a white box testing technique that
is usually performed by the developer.
10
How unit tests work?
Planning, developing test cases and running the test itself. Developers or QA experts
prepare and examine the unit test in the first stage. They then go on to writing test cases
and scripts. The code is tested in the third stage.
For test driven development to work unit tests must first be written that fail. As soon as
the text succeeds, they create code and restructure the application.
To confirm that the code has no dependencies, each test case is run separately in an
isolated environment. The software developer should utilize a testing framework to
record any failed tests and write criteria to validate such test case. The criteria of tests
for every line of code would be time-consuming for developers.
Only those properties that are essential to the operation of the unit being evaluated are
included in unit testing. This enables developers to make modifications to the source
code without worrying about how they could affect the operation of other components or
the programme as a whole right way.
Advantages of Unit Testing:
Compound mistakes happen less often the sooner an issue is discovered.
Fixing issues as they arise is often less expensive than waiting until they become
serious.
Simplified debugging procedures.
The codebase can be modified easily by developers
Code may be transferred to new projects and reused by developers.
Disadvantages of Unit Testing:
Not all bugs will be found during tests
Unit testing does not identify integration flaws; it just checks data set and their
functionality.
To test one line of code, more lines of test code may need to develop, which might
require additional time.
To successfully apply unit testing, developers may need to pick up new skills, such as
how to utilize certain automated software tools.
11
Integration Testing: Integration testing also known as Integration and testing (I&T) – is a type
of software testing in which the different units, modules or components of a software application
are tested as a combined entity.
The second stage of the software testing process, after unit testing, is known as
integration testing. Integration testing is the process of inspecting various parts or units
of a software project to reveal flaws and ensure that they function as intended.
The typical software project often comprises of multiple software modules, many of
which were created by various programmers. Integration testing demonstrates to the
group how effectively these dissimilar components interact.
Therefore, integration testing is how we determine if the many components of a software
programme work properly together.
Why perform Integration Testing?
There are many particular reasons why developers should do integration testing.
Errors might result from incompatibility between programme components.
Every software module must be able to communicate with the database and
requirements are subject to change as a result of customer feedback.
Every software developer has their own conceptual framework and coding logic. Integrity
testing guarantees that these diverse elements work together seamlessly.
Modules often interface with third-party APIs tools; thus we require integration testing to
confirm that the data these tools receive in accurate.
There may be possible hardware compatibility issue.
12
Advantages of Integration Testing:
Integration testing ensures that every integrated module function correctly.
Integration testing uncovers interface errors
Testers can initiate integration testing once a module is completed and doesn't require
waiting for another module to be done and ready for testing.
Testers can detect bugs, defects and security issues.
Integration testing provides testers with a comprehensive analysis of the whole system,
dramatically reducing the likelihood of severe connectivity issues.
Challenges of Integration Testing:
Questions will arise about how components from two distinct systems produced by two
different suppliers will impact and interact with one another during testing.
Integrating new and old systems requires extensive testing and possible revisions.
Integration testing needs testing not just the integration connections but the environment
itself, adding another level of complexity to the process.
This is because integration testing requires testing not only the integration links but the
environment itself.
System Testing: System testing is a level of testing that validates the complete and fully
integrated software product. The purpose of a system test is to evaluate the end-to-end system
specifications. The software is interfaced with other software/hardware systems.
What is the process of system testing?
The steps for system testing are as follows:
Setup the test environment: Establish the test environment for higher-quality testing.
Produce a test case: Produce a test case for the testing procedure
Produce test data: Produce the data that will be put to the test
Execute test case: Test cases are carried out after the production of the test case and
the test data.
Defect reporting: Systems flaws are discovered.
Regression Testing: This technique is used to examine the consequences of the
testing procedure's side effects.
Log defects: In this stage, defects are corrected.
Retest: If the first test is unsuccessful, a second test is conducted.
13
What are the types of System testing?
Performance testing: Is a sort of software testing used to evaluate the speed, scalability,
stability, and dependability of software applications and products.
Load Testing: This sort of software testing is used to ascertain how a system or software
product will behave under high loads.
Stress testing: Stress testing is a sort of software testing carried out to examine the
system's resilience under changing loads.
Testing of scalability is a sort of software testing used to evaluate how well a system or
software application performs in terms of its capacity to scale up or scale down the
volume of user requests.
Advantages of system testing:
The testers don't need to have further programming experience to do this testing.
It will test the complete product or piece of software, allowing us to quickly find any faults
or flaws that slipped through integration unit testing.
The testing environment resembles a real-world production or commercial setting.
It addresses the technical and business needs of customers and uses various test
scripts to verify the system's full operation.
Following this testing, the product will have practically all potential flaws or faults fixed
allowing the development team to safely go on to acceptance testing.
Disadvantages of System testing:
Testing involves checking the complete product or piece of software, it takes longer than
other testing methods.
Since the testing involves testing the complete the piece of software, the cost will be
considerable.
Without a proper debugging tool, the hidden faults won't be discovered.
14