1 Introduction
1 Introduction
Unit 1
STM
Software Testing Methodologies
Unit1-Introduction
1. The Purpose of Testing
2. Dichotomies
4. Taxonomy of Bugs
Purpose of Testing:
Software testing is an activity that is used to evaluate the capabilities of a system and
determine if it is accordance with the specification
Testing is the process of executing a program with the intent of finding errors
Bug prevention – Designing Tests is considered as the best bug preventer or. it means
that if a test is properly designed it is easy to detect and prevent the bugs. Before coding itself. If
testing is performed at every stage of software development we can eliminate most of the bugs
would be discovered and prevented in design phase itself.
Bug discovery: It is performed when the primary goal fails to prevent the bugs.. A single
bug can have many reasons. Therefore just by determining that the PG is incorrect does n’t
reveal the discovery of bugs. each symptom can be revealed only by performing many small
detailed tests on each of the individual symptoms.
Phase 2:The POT is to show that the software does not works
Phase 3: The POT is reduce the perceived risk of not working to an acceptable level
Phase 4: It is mental discipline that results in low risk software without much testing effort
Unit 1
Before we going for testing, we must first review, inspect, read, do walkthroughs and then test
Dichotomies
Testing versus Debugging
Function versus Structure
Designer versus Tester
Modularity versus Efficiency
Small versus Large
Builder versus Buyer
The purpose of testing is to show that a program has bugs. The purpose of debugging is find
the error that led to the program’s failure and to design and implement the program changes that
correct the error. Debugging usually follows testing, but they differ as to goals, methods, and
most important, psychology:
1. Testing starts with known conditions, uses predefined procedures, and has
predictable outcomes Debugging starts from possibly unknown initial conditions, and the
end cannot be predicted, except statistically.
2. Testing can and should be planned, designed, and scheduled. The procedures for,
and duration of, debugging cannot be so constrained.
3. Testing is a demonstration of error or apparent correctness. Debugging is a deductive
process.
4. Testing proves a programmer’s failure. Debugging is the programmer’s vindication.
Unit 1
6. Much of testing can be done without design knowledge. Debugging is impossible
without detailed design knowledge.
7. Testing can often be done by an outsider. Debugging must be done by an insider.
Tests can be designed from a functional or a structural point of view. In functional testing the
program or system is treated as a black box. It is subjected to inputs, and its outputs are verified
for conformance to specified behavior. The software’s user should be concerned only with
functionality and features, and the program’s implementation details should not matter. Functional
testing takes the user’s point of view.
Structural testing does look at the implementation details. Such things as programming style,
control method, source language, database design, and coding details dominate structural
testing;
Most software is written and used by the same organization. Unfortunately, this situation lost the
accountability. Many organizations today recognize the virtue of independent software
development and operation because it leads to better software, better security, and better testing.
The builder, who designs for and is accountable to, the buyer, who pays for the system in the
hope of profits from providing services,
A module is a small component of a system. The smaller the component, the easier it is to
understand; but every component has interfaces with other components, and all interfaces are
sources of confusion. The smaller the component, the likelier are interface bugs. Large
components reduce external interfaces but have complicated internal logic that may be difficult or
impossible to understand
Tests
Tests are formal procedures. Inputs must be prepared, outcomes predicted, tests
documented, commands executed, and results observed; all these steps are subject to error..
Unit 1
Unit, Unit Testing—. Unit testing is the testing we do to show that the unit does not
satisfy its functional specification and/or that its implemented structure does not match
the intended design structure
Component, Component Testing—Component testing is the testing we do to show
that the component does not satisfy its functional specification and/or that its
implemented structure does not match the intended design structure. When our tests
reveal such problems, we say that there is a component bug.
Integration, Integration Testing—. Integration testing is testing done to show that
even though the components were individually satisfactory the combination of
components is incorrect or inconsistent.
System, System Testing—A system is a big component System testing concerns
issues and behaviors that can only be exposed by testing the entire integrated system or
a major part of it. System testing includes testing for performance, security,
accountability, configuration sensitivity, start-up, and recovery.
Overview
From these models we create a set of tests, which are then executed. The result of
each test is either expected or unexpected.
If unexpected, it may lead us to revise the test, our model or concept of how the program
behaves, our concept of what bugs are possible, or the program itself. Only rarely would we
attempt to modify the environment.
Unit 1
Importance of bugs:
Consequences of Bugs:
Mild
Moderate
Annoying
Disturbing
Serious
Very serious
Extreme
Intolerable
Catastrophic
Infectious
Test debugging
Test quality assurance
Test execution automation
Test design automation
Unit 1
Unit 1
What is meant by statement coverage (C1) and branch coverage (C2)? Explain with
an example, how to select enough paths to achieve C1+C2.
exercise every
Path–Testing Criteria
Any testing strategy based on paths must at least both exercise every instruction and
take branches in all directions.
A set of tests that does this is not complete in an absolute sense, but it is complete in
the sense that anything less must leave something untested.
There are three different testing criteria or strategies out of a potentially infinite
family of strategies.
1. Path Testing
2. Statement Testing
3. Branch Testing
Statement Coverage
Execute all statements in the program at least once under some test. If we
do enough tests to achieve this, we are said to have achieved 100%
statement coverage (C1) This is the weakest criterion in the family: testing
less than this for new software is unconscionable and should be
criminalized.
Unit 1
Branch Coverage
Branch Testing (P2) Execute enough tests to assure that every branch
alternative has been exercised at least once under some test. If we do
enough tests to achieve this prescription, then we have achieved 100%
branch coverage (C2). For structured software, branch testing and
therefore branch coverage strictly includes statement coverage.
Example
The question of what is the fewest number of such paths is interesting to the
designer of test tools that help automate path testing
As an example of how to go about selecting paths take any simple graph
Start at the beginning and take the most obvious path to the exit—it typically
corresponds to the normal path.
Then take the next most obvious path (CHOOSE YOUR OWN/ANY EXAMPLE),
As you trace the paths, create a table that shows the paths, the coverage status of each process, and
each decision
Loop
Set of statements repeated for specified number of times or until it meets
specific condition is called as a Loop. For example print statement which is
included in a for loop executes n number of times based on condition in for
loop. There are four types of loops 1. Single Loop 2. Nested Loop 3.
Concatenated Loop 4. Horrible Loop
Single Loop
A simple loop that executes based on the following cases are considered as single loop.
Unit 1
Case 1 Single Loop, Zero Minimum, N Maximum, No Excluded Values
for(i=0;i<=10;i++)
{
printf(“%d”,i); // loop begins with 0 and ends with 10
}
Case 2 Single Loop, Nonzero Minimum, No Excluded Values
for(i=10;i<=20;i++)
{
printf(“%d”,i); // loop begins with 10 and ends with 20
}
Case 3 Single Loops with Excluded Values
for(i=1;i<=10;i+=2)
{ printf(“%d”,i); //loop excludes even numbers
}
Try one less than the expected minimum. Check boundary of control variable
The minimum number of iterations.
One more than the minimum number of iterations.
Once, unless covered by a previous test.
Twice, unless covered by a previous test.
A typical value.
One less than the maximum value.
The maximum number of iterations.
Attempt one more than the maximum number of iterations.
Nested Loop
Loop with in another loop can be called as Nested loop as like…
for(i=1;i<=10;i+=2)
{
for(j=1;j<=10;j+=2)
{
printf(“%d”,i+j);
}
}
Start at the innermost loop. Set all the outer loops to their minimum values.
Test the minimum, minimum + 1, typical, maximum – 1, and maximum for the
innermost loop.
If you’ve done the outermost loop, GOTO step 5, otherwise move out one loop and
set it up as in step 2—with all other loops set to typical values.
Continue outward in this manner until all loops have been covered.
Do the five cases for all loops in the nest simultaneously
Concatenated Loops
Unit 1
Concatenated loops fall between single and nested loops with respect to test cases.
Two loops are concatenated if it’s possible to reach one after exiting the other while
still on a path from entrance to exit.
If the loops cannot be on the same path, then they are not concatenated and can be
treated as individual loops.
Horrible Loops
The thinking required to check the end points and looping values for intertwined
loops appears to be unique for each program.
It’s also difficult at times to see how deeply nested the loops are, or indeed whether
there are any nested loops.
The use of code that jumps into and out of loops, intersecting loops, hidden loops,
and cross–connected loops, makes iteration
value selection for test cases very difficult, an awesome and ugly task, which is
another reason such structures should be avoided.
As you trace the paths, create a table that shows the paths, the coverage status of each process, and
each decision
Testing blindness is a pathological situation in which the desired path is achieved for
the wrong reason.
It can occur because of the interaction of two or more statements that makes the
buggy predicate work despite its bug
There are three types of blindness, they are
Unit 1
1. Assignment blindness
2. Equality blindness
3. Self–blindness
Assignment Blindness
Assignment blindness occurs when the buggy predicate appears to work correctly.
Specific value chosen for an assignment statement works with both the correct and
incorrect predicate.
For example:
Correct Bug
testX=20; testX=20;
…….. …….
if(testY>0) if(testX+testY>0)
{ {
} }
Equality Blindness
Equality blindness occurs when the path selected by a prior predicate results in a
value that works both for the correct and buggy predicate.
For example:
Correct Bug
if(testY==20) if(testY==20)
…….. …….
if(testX+testY>30) if(testX>10)
{ {
} }
Unit 1
o Trace the path through, multiplying (boolean) the individual compound
predicates to achieve a boolean expression.
o Multiply out the expression to achieve a sum–of–products form
o Each product term denotes a set of inequalities that, if solved, will yield an
input vector that will drive the routine along the designated path.
o Solve any one of the inequality sets for the chosen path and you have found
a set of input values for the path.
The act of finding a set of solutions to the path predicate expression is called path
sensitization.