Unit 1
Unit 1
Prepared by,
Mrs.A.Anorelin, AP/CSE
CS366/DMIEC
COURSE OBJECTIVES:
•To understand the basics of software testing
•To learn how to do the testing and planning effectively
•To build test cases and execute them
•To focus on wide aspects of testing and understanding multiple
facets of testing
• To get an insight about test automation and the tools used for test
automation
UNIT I FOUNDATIONS OF SOFTWARE TESTING 6
Why do we test Software? Black-Box Testing and White-Box Testing, Software
Testing Life Cycle, V-model of Software Testing, Program Correctness and
Veri昀椀cation, Reliability versus Safety, Failures, Errors and Faults (Defects),
Software Testing Principles, Program Inspections, Stages of Testing: Unit Testing,
Integration Testing, System Testing
30 PERIODS
CS366/DMIEC
COURSE OUTCOMES:
CO1: Understand the basic concepts of software testing and the need for software
testing
CO2: Design Test planning and different activities involved in test planning
CO3: Design effective test cases that can uncover critical defects in the application
CO4: Carry out advanced types of testing
CO5: Automate the software testing using Selenium and TestNG
TOTAL:60 PERIODS
TEXTBOOKS
This chapter will discuss the fundamentals of testing, such as why testing is
required, its limitations, airs and purposes, as well as the guiding principles, step- by-
step methods and psychological concerns that testers must: take into mind. You will
be able to explain the fundamentals of testing after reading this chapter.
Software testing is a method for figuring out if the real piece of software meets
requirements and is error-free. It involves running software or system components
manually of automatically in order to evaluate one or more intriguing characteristics.
Finding faults; gaps or 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 (AUT). In this course, software testing is explained to
the audience and its importance is justified.
Testing includes both the analysis and execution of the code in different
settings and environments, as well as the whole code analysis. A testing team may be
independent from the development team in the present software development
scenario so that information obtained from testing may be utilized to improve the
software development process.
Software flaws may be costly or even harmful, thus testing instances when
software defects led to financial and personal loss is crucial. History is replete with
➢ Over 300,000 traders in the financial markets were impacted after a software
error caused the London Bloomberg terminal to collapse in April 2015. It
made the government delay a 3-billion-pound debt auction.
CS366/DMIEC
➢ Nissan recalled nearly 1 million: vehicles from the market because the
airbag sensory detectors’ software was flawed. Due to this software flaw,
two accidents have been documented.
➢ Starbucks' POS system malfunctioned, forcing them to shut nearly 60 % of its
locations in the United States and Canada. The shop once provided free coffee
since they couldn't complete the purchase. -
➢ Due to a technical error, some of Amazon's third-party sellers had them
product prices slashed to 1p. They suffered severe losses as a result.
➢ A weakness in windows 10. Due to a defect in the win32k system, users are
able to bypass security sandboxes thanks to this issue.
➢ In 2015, a software flaw rendered the F-35 fighter jet incapable of accurately
detecting “targets. On April 26, 1994; an airbus A300 operated by China
airlines crashed due to a software error, killing 264 unintentional people.
➢ Three patients died and three others were badly injured in 1985 when a
software glitch caused Canada's Therac-25 radiation treatment system to fail
and deliver deadly radiation doses to patients.
➢ In May 1996, a software error led to the crediting of 920 million US dollars.
to the bank accounts of 823 clients of a large U.S. bank.
➢ In April 1999, a software error resulted in the failure of a $1.2 billion
military satellite launch, making it the most expensive, accident in history.
1.1.5 What are the Benefits of Software Testing?
Security: This perilous and delicate advantage of software testing. People are
searching for reliable goods. It assists in eradicating hazards and issues early.
Product quality: Any software product must meet these criteria. Testing guarantees
that buyers get a high-quality product.
1. Manual testing:
Manual testing can be further divided into three types of testing, which are as
follows:
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 is known
as automation testing. ‘With the help of automation testing, we can enhance the speed
of our test execution because here, we do not require any human efforts. We need to
write a test script and execute those scripts.
CS366/DMIEC
Black box testing (also called functional testing) is testing that ignores the
internal mechanism of a system or component and focuses solely on the outputs
generated in response to selected inputs and execution conditions. White box testing
(also called structural testing and glass box testing) is testing that takes into account
the internal mechanism of a system or component.
Developers carry it out before sending the program to. the testing team, who
then conducts black-box testing. Testing the infrastructure of the application is the
primary goal of white-box testing. As it covers unit testing and integration testing, it
is performed at lower levels. Given that it primarily focuses on the code structure,
pathways, conditions and ‘branches of a programed or piece of software, it
necessitates programming skills. Focusing on the inputs and outputs via the program
and enhancing its security are the main objectives of white-box 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:
1. Unit testing: Tests individual units or components of the software to ensure they
function as intended.
CS366/DMIEC
3. Functional testing: Tests the functionality of the software to ensure it meets the
requirements and specifications.
4. Performance testing: Tests the performance of the software under various loads
and conditions to ensure it meets performance requirements.
5. Security testing: Tests the software for vulnerabilities and weaknesses to ensure
it is secure.
6. Code coverage testing: Measures the percentage of code that is executed during
testing for ensure that all parts of the code are tested.
7. Regression testing: Tests the software after changes have been made to ensure
that the changes did not introduce new bugs or issues.
1. 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. As a result, the code
is checked line by line.
2. Branch coverage: Is a testing approach in which test cases are created to ensure
that each ranch is tested at léast once. This method examines all potential
configurations for the system.
3. Path coverage: Path coverage is a software testing 2pproach that defines and
covers all potential pathways. From system entrance to exit points, pathways are
statements that may ‘be executed. It takes a lot of time.
4. 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. This method included testing loops
• Concatenated loops
• Simple loops
• Nested loops
CS366/DMIEC
5. Basis path testing: Using this methodology, control flow diagrams are created
from code and subsequently calculations are made for cyclomatic complexity. For the
purpose of designing the fewest possible test cases, cyclomatic complexity specifies
the quantity of separate routes.
1. Complete coverage.
2. Better understanding of the system.
3. Improved code quality.
4. Increase efficiency.
5. Early detection of error.
due for the complexity of the level of testing that needs to be done.
Testing a system in a "black box" is doing so without knowing anything about how it
operates within. A tester inputs data and monitors the output produced by the system being
tested. This allows for the identification of the system's reaction time, usability difficulties
and reliability concerns as well as how the system reacts to anticipated and unexpected user
activities.
Because it tests a system from beginning to finish, black box testing is a potent
testing method. A tester may imitate user action to check if the system fulfills its
promises, much as end users "don't care” how a system is programmed or designed
S. No Pros Cons
1 Testers do not require technical Difficult to automate.
knowledge, programming of IT skills.
Black box testing can be applied to three main types of tests : Functional, non-
functional and regression testing.
1. Functional testing:
Specific aspects or operations of the program that is being tested may be tested
via black box testing. For instance, make sure that the right user credentials may be
used to log in and that the incorrect ones cannot.
Functional testing might concentrate on the most important features of the
program (smoke testing/sanity testing), on how well the system works as a whole
(system testing) or non the integration of its essential components.
2. Non-functional testing:
• Beyond features and functioning, black box testing allows for the inspection
of extra software components. A non-functional test examines "how" rather
than "if" the program can carry out a certain task.
• Black box testing may determine whether software is:
CS366/DMIEC
3. Regression testing:
1. Equivalence partitioning:
Testing professionals may organize potential inputs into "partitions" and test
just one sample input from each category. For instance, it is sufficient for testers to
verify one birth date in the "under 18" group and one date in the "over 18" group if a
system asks for a user's birth date and returns the same answer for users under the age
of 18 and a different response for users over 18.
Testing personnel may concentrate on the boundary values (1, 0, 99 and 100)
to determine if the system is appropriately accepting and rejecting inputs.
It can be referred to as outer or external It is the inner or the internal software testing.
software testing.
It is a functional test of the software. It is a structural test of the software.
This testing can be initiated based on the This type of testing of software is started after
requirement specifications document. a detail design document.
No knowledge of programming is required. It is mandatory to have knowledge of
programming.
It is the behavior testing of the software. It is the logic testing of the software.
It is applicable to the higher levels of testing It is generally applicable to the lower levels of
of software. software testing.
It is also called closed testing. It is also called as clear box testing.
It is least time consuming. It is most time consuming.
It is not suitable or preferred for algorithm
It is suitable for algorithm testing.
testing.
Can be done by trial and error ways and Data domains along with inner or internal
methods. boundaries can be better tested.
Example: Search something on google by Example: By input to check and verify loops
using keywords
Black-box test design techniques-
White-box test design techniques-
• Decision table testing
• Control flow testing
• All-pairs testing
• Data flow testing
• Equivalence partitioning
• Branch testing
• Error guessing
A testing technique called the Software Testing Life Cycle (STLC) may
effectively help you satisfy software quality requirements. Systematic testing is
mandated by STLC and 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 consumed with the whole development process.
Continue reading for 2 detailed analyses of STLC's six stages.
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 and orderly manner.
Goals and deliverables are varied for each phase. The STLC stages vary depending
on the organization, but the fundamentals are the same.
2. Planning phase
3. Analysis phase
4. Design phase
5. Implementation phase
6. Execution phase
7. Conclusion phase
8. Closure phase
CS366/DMIEC
2. The planning phase: Is the initial stage of the testing procedure’ in real-world -
Produce metrics for test coverage circumstances. The actions and resources that will
help us achieve the testing goals.
6. Execution phase: As its name implies, this is the stage of the software testing life
cycle - Risk management and mitigation, as well as risk analysis. when actual
execution occurs.
CS366/DMIEC
7. Conclusion Phase: The exit criteria and reporting are the main topics of this
STLC phase. We need to try to accurately capture the test circumstances in writing.
You may, for instance, include the test condition "User should be able to make a
payment" for an e-commerce web application. The user should be allowed to make
payments through NEFT, debit cards and credit cards or you might specify it by
specifying it.
8. Closure phase: The following tasks are part of the closure activities:
• Verify that the test has been completed. Whether all test scenarios are run or
intentionally mitigated. Verify that no faults of severity 1 have been opened.
• Hold meetings to discuss lessons learned and produce a paper detailing
them. (Include what worked well, where changes are needed and what may
be done better.)
1.5 V-Model of Software Testing
Also known as the verification and validation model, the V-model. This
requires that each stage of the SDLC be completed before moving on to the next. The
waterfall model's sequential design approach is also followed. The device's testing is
scheduled concurrently with the relevant stage of development.
CS366/DMIEC
Therefore, the V - model features validation stages on one side and verification phases
on the other. Coding phase joins the verification and validation processes in a V-
shape. As a result, it is known as V - model.
Play video in backward skip 10s there are many stages in the V - model's verification
phase:
1. Business requirement analysis: This is the initial phase in which customer-side
product needs are understood. To fully comprehend the expectations and precise
needs of the consumer, this step involves comprehensive discussion.
understanding of everything that will be included, such as the list of modules, a short
description of each module's operation, the linkages between the modules’ interfaces,
5. Coding step: The coding step ‘is started after designing. It is determined on a
programming language that will work best based on the criteria. For coding, there are
certain rules and standards. The final build is enhanced for greater performance prior
to checking it into the repository and the code undergoes several code reviews to
verify its performance.
CS366/DMIEC
1. Unit testing: Unit Test Plans (UTPs) are created in the V - model's module design
phase. To get rid of problems at the unit or code level, these UTPs are run. The
smallest thing that can exist on its own is a unit, such a program module. Unit testing
ensures that even the tiniest component can operate properly when separated from
other scripts or units.
2. Integration testing: During the architectural design phase, integration test plans
are created. These experiments demonstrate that separate groups may live and interact
with one another.
3. System testing: During the system design phase, plans for system tests are
created. System test plans, in contrast to unit and integration test plans, are created by
the client's business team. System testing makes ensuring that an application
developer's requirements are satisfied.
• 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 downward flow of the defects.
• Works well for small plans where requirements are easily understood.
CS366/DMIEC
• The goal of software testing is to run the potential program on a set of input
data and determine if it acts according to- specification. Software testing
includes the study of correctness since it is only possible to analyze a
program's behavior if we are aware of what constitutes a proper behavior.
• In particular, it leads to making assumptions about the behavior of the
program at particular points in its execution and then verifying (or disproving)
these assumptions. The same assumptions can be checked at run-time during
testing, providing us with useful information as we attempt to diagnose the
program or establish its correctness. Therefore, the abilities we acquire while
we attempt to demonstrate the correctness of a program assist us to be
better/more efficient testers.
• Program testers and program providers often make kind remarks about
how testing and proving are complimentary while scrupulously ignoring one
another (and one other methodologies). Complementarity, however, is more
complex than first seems. A testing technique or a proving method is often
rendered useless not by any inherent quality of the approach but father by
being used incorrectly.
1.7 Reliability Versus Safety
The chance that a software system completes its assigned job in a certain
environment for a predetermined number of input instances, assuming that the
hardware and the input are error-free, is another definition of software reliability.
1. Software failures
• Before describing the steps needed to analyses the dependability and safety of
software, it is critical to comprehend what a software failure entail. The
random or wear-related failure behavior. we see in hardware is not present in
software. As long as the same input and computer states are present, software
will always operate in the same manner.
• System failures may be brought on by software due to implementation or
design flaws. Wrong assumptions about how a system will operate, such as
the assumption that input A always comes after input B, are a common source
of design mistakes.
• Symbols that are unclear, such as ‘g' instead of 'G," are a common source of
implementation mistakes. Software flaws can only result in failures if they are
discovered while being used.
CS366/DMIEC
• Therefore, flaws in commonly used code will result in failures more often
than flaws in seldom used code, albeit both may be significant. It is especially
crucial to examine and verify seldom used code in applications that are
mission- or safety-critical.
2. What is an Error?
Error is the phrase used to describe this circumstance and was mostly created
by the developers. Wrong logic, grammar or loops may produce errors that affect the
end-user experience.
• The difference between predicted and actual outcomes is used to compute it.
• It arises for a variety of causes, such as application challenges brought on by
design, code or system specification problems.
3. What’s a fault?
Sometimes due to specific conditions Tike a lack of finances or failing to take
the necessary precautions When a softwire error occurs, it signifies that the logic to
manage the application's problems was not included. Although this is a bad condition,
it often results from incorrectly specified stages or a lack of data definitions.
• 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 number 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.
CS366/DMIEC
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 labor 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 as
doing such testing scenarios would violate the product timeframes.
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.
5. Pesticide paradox:
• This rule said that if the same set of test cases were run again over a given
period of time, the tests would not be able to discover any new problems in
the program or application.
CS366/DMIEC
• Reviewing all the test cases periodically are crucial to overcoming these
pesticide contradictions. Additionally, in order to incorporate many
components of the application or program, new and different tests must be
created, which aids in the discovery of additional flaws.
6. Testing is context-dependent:
Steps of inspection:
CS366/DMIEC
1. 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.
2. Overview: In the overview phase, a presentation is given to the inspector with some
background information needed to review the software product properly.
4. Meeting: The moderator conducts the meeting. In the meeting, the defects are
collected and reviewed.
5. Rework: The author performs this part of the process in response fo defect
disposition determined at the meeting.
6. Follow-up: In follow-up, the moderator makes the corrections and then compiles
the inspection management and defects summary report.
Characteristics of inspection:
• Three steps make up a unit test: 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 test succeeds, they create code and restructure the application.
TDD often produces a code base that is clear and predictable.
CS366/DMIEC
• 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
each test case.
• The creation of tests for every line of code would be time-consuming for
developers. The code that could influence how the program being created
behaves should be the focus of the tests that developers write.
• 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 program as a whole right away.
• Teams may use integration testing to assess bigger program components
after every unit in the program operates as effectively and error- free as
feasible.
• Unit tests may be run manually or automatically by developers. An intuitive
document outlining each stage in the process may be developed for those
using a manual technique, however automation testing is the most popular
approach for unit testing.
• Automated methods often create test cases using a testing framework. In
addition to presenting a summary of the test cases, these frameworks are also
configured to flag and report any failed test cases.
Unit testing advantages:
‘While unit testing is integral to any software development and testing strategy; there
are some aspects to be aware of. Disadvantages to unit testing include the following:
CS366/DMIEC
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. In spite of the fact
that each component.
• 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.
Produce a test case: Produce a test case for the testing pes
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
cand the test data.
Defect reporting: System flaws are discovered.
•
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:
The process of software testing aims not only at finding faults in the existing
software but also at finding measures to improve the software in terms of efficiency,
accuracy and usability. It mainly aims at measuring the specification, functionality
and performance of a software program or application.
The technique of testing in which the tester doesn’t have access to the source
code of the software 4nd is conducted at the software interface without any concern
with the internal logical structure of the software is known as black - box testing.
1. Unit testing: A level of the software testing process where individual units /
components of a software / system are tested. The purpose is to validate that each unit
of the software performs as designed.
CS366/DMIEC
2. Integration testing: A level of the software testing process where individual units
are combined and tested as a group. The purpose of this level of testing is to expose
faults in the interaction between integrated units.
3. System testing: A level of the software testing process where a complete,
integrated system / software is tested. The purpose of this test is to evaluate the
system's compliance with the specified requirements.
3. Early testing
4. Defect clustering
5. Pesticide paradox
1. Manual testing: Manual testing includes testing software manually, i.e., without
using any automation tool or any script. In this type, the tester takes over the role of
an end- user and tests the software to identify any unexpected behavior or bug. There
are different stages for manual testing such as unit testing, integration testing, system
testing and user acceptance testing.
Testers use test plans, test cases, or test scenarios to test software to ensure the
completeness of testing. Manual testing also includes exploratory testing, as testers
explore the software to identify errors in it.
CS366/DMIEC
Apart from regression testing, automation testing is also used to test the
application from a load, performance and stress point of view. It increases the test
coverage, improves accuracy and saves time and money when compared to manual
testing.
Integration testing is the second level of the software testing process comes
after unit testing. In this testing, units or individual components of the software are
tested in a group. The focus of the integration testing level is to expose defects at
the time of interaction between integrated components or units.
Verification Validation
1.Verification is the process 1.
of evaluating s o f t w a r e s y s t e m o r Verification is the process of evaluating
component to determine whether the software system or component during
products of a given development phase or at the end of the, the development
satisfy the conditions imposed at the phase satisfies the conditions imposed
start of that phase. at the start of that phase.
2.Verification is usually associated 2.Verification is usually associated
with activities such as inspections and with Traditional execution _based
reviews of the s/w deliverables. testing, i.e. Exercising the code with
testcases.
• A test case in a practical sense is attest related item which contains the
following information.
• A set of test inputs. These are data items received from an external source by
the code under test.
• The external source can be hardware, software, or human. Execution
conditions. These are conditions required for running the test, for example, a
certain state of a database, or a configuration of a hardware device. Expected
outputs. These are the specified results to be produced by the code under test.
CS366/DMIEC
22. Write short notes on Test, Test Set, and Test Suite?
• A Test is a group of related test cases, or a group of related test cases and
test procedure.
• A group of related tests is sometimes referred to as a test.
• A group of related tests that are associated with a database, and are usually
run together, is sometimes referred to as a test.
A test bed is an environment that contains all the hardware and software
needed to test a software component or a software system.
Part- B & C
1. S t a t e and expl ai n S oftw a r e t es t i ng p r i n c i p l e s ?