Unit Iv Testing: 4.1taxonomy of Software Testing
Unit Iv Testing: 4.1taxonomy of Software Testing
com
UNIT IV
TESTING
Testing involves exercising the program using data like the real data
processed by unexpected system outputs.
Testing may be carried out during the implementation phase to verify that
the software behaves as intended by its designer and after the implementation is
complete. This later phase checks conformance with requirements is complete.
statistical testing may be used to test the programs performance and reliability
defect testing is intended to find the areas where the program does not
conform to its specification
Testing Vs Debugging:
www.vidyarthiplus.com Page 1
www.vidyarthiplus.com
1. Testing starts with unknown conditions, uses predefined procedures, and has
predictable outcomes only whether or not the program passes the test id
unpredictable.
2. Testing can and should be planned designed and scheduled the procedures for
and duration of debugging cannot be so constrained.
Testing Objectives:
2. A good test case is one that high probability of finding an as yet undiscovered error.
www.vidyarthiplus.com Page 2
www.vidyarthiplus.com
Testing Principles:
1. All tests should be traceable to customer requirements. The most serve defects
are those that cause the program fail to meet its requirements.
2. Test should be planned long before testing begins. All tests can be planned and
designed before any code has been generated.
3. Testing should begin “in the small” and progress towards testing “in the large”.
The first tests planned and executed generally focus on the individual components. As
testing progresses, focus shifts in an attempt to find errors in integrated clusters of
components and ultimately in the entire system.
www.vidyarthiplus.com Page 3
www.vidyarthiplus.com
3. In a group of tests that have a similar intent, time and resource, the test that has
the highest likelihood of uncovering a whole class of errors should be used.
4. A good test should be neither too simple nor too complex. Each test should be
executed separately.
Unit testing
Module
testing
Sub-system
www.vidyarthiplus.com testing Page 4
www.vidyarthiplus.com
System
testing
Acceptance
testing
1. unit testing
2. module testing
3. sub-system testing
4. system testing
5. acceptance testing
Here individual components are tested to ensure that they operate correctly. Each
component is tested separately.
www.vidyarthiplus.com Page 5
www.vidyarthiplus.com
Here his phase involves testing collection of modules which have been
integrated into sub-systems. Sub-systems be independently designed and
implemented. The most common problems which arise in large s/w systems are sub-
systems interface mismatches.
The sub-systems are integrated to the entire system. The testing process is
concerned with finding errors which results from anticipated interactions between
sub-systems and system components. It is also concerned with validating that the
system meets its functional and non-functional requirements.
This is the final stage in the testing process before the system is accepted
for operational use. The system is tested with data supplied by the system producer
rather than stimulated test data. Acceptance testing may reveal errors and omissions
in the system requirements definition because the real data exercise the system in
different ways from the test data. Acceptance testing may also reveal requirements
problems where the systems facilities do not really meet the user’s needs or the
system performance is unacceptable.
www.vidyarthiplus.com Page 6
www.vidyarthiplus.com
Top – down testing test the high level s of a system before testing its
detailed components. The program is represented as a single abstract component
with sub-components represented by stubs. Stubs have the same interface as the
component but very limited functionality.
After the top level components have been tested, its sub-components
are implemented and tested in the same way. This process continues recursively until
the bottom level components are implemented. The whole system may then be
completely tested.
1. Unnoticed design errors may be detected at a early stage in the testing process.
As these errors are mainly structural errors ,early detection means that can be
corrected without undue costs
www.vidyarthiplus.com Page 7
www.vidyarthiplus.com
2. Test output may be difficult to observe. In many systems, the higher levels of that
system do not generate output but, to test these levels, they must be do so. The
tester must create an artificial environment to generate the test results.
When using bottom-up testing, test drivers must be written to exercise the
lower-level components. These test drivers must be written to exercise the lower-
level components. These test drivers simulate the components environment and are
valuable components in their own right.
If the components being tested are reusable components, The test drivers
and test data should be distributed with the component.
www.vidyarthiplus.com Page 8
www.vidyarthiplus.com
Potential re-users can then run these tests to satisfy themselves that the
component behaves as expected in their environment.
4.4Unit testing
It begins at the vortex of the spiral and concentrates on each unit of the s/w as
implemented in source code.
Finally system testing is conducted. In this the software and other system
elements are tested as a whole.
1. Unit Testing:
www.vidyarthiplus.com Page 9
www.vidyarthiplus.com
The module interfaces is tested to ensure that information properly flows into
and out of the program until under test.
The local data structures is examined to ensure that data stored temporarily
maintains its integrity during all steps in an algorithm’s execution.
Boundary conditions are tested to ensure that the module operates properly at
boundaries established to limit or restrict processing.
All independent paths through the control structure are exercised to ensure
that all statements in a module have been executed at least once.
Finally, all error handling paths are tested.
This testing is the re execution of some subset of tests that have already
been conducted to ensure that changes have not propagated unintended side
effects.
Regression testing is the activity that helps to ensure that changes do not
introduce unintended behavior or additional errors.
The regression test suite contains three different classes of test cases:
www.vidyarthiplus.com Page 10
www.vidyarthiplus.com
4.6Validation testing:
After each validation has been conducted, one of the two possible
conditions exist:
Configuration review:
www.vidyarthiplus.com Page 11
www.vidyarthiplus.com
1. Recovery testing
2. Security testing
3. Stress testing
4. Performance testing
Recovery testing:
Many computer based systems must recover from faults and resume
processing within a prespecified time.
www.vidyarthiplus.com Page 12
www.vidyarthiplus.com
Recovery testing is a system test that forces the s/w to fail in a variety of
ways and verifies that recovery is properly performed.
Security testing:
During security testing, the tester plays the role of the individual who
desires to penetrate the system.
Stress testing:
www.vidyarthiplus.com Page 13
www.vidyarthiplus.com
Performance testing
For real time and embedded systems, software that provides required function but does not
conform to performance requirements is unacceptable. Performance testing is designed to test the run-
time performance of s/w within the context of an integrated system.
Performance testing occurs throughout all steps in the testing process. Even at the unit level,
the performance of an individual module may be assessed.
Performance tests are often couple with stress testing and usually require both hardware and
s/w instrumentation.
www.vidyarthiplus.com Page 14
www.vidyarthiplus.com
Debugging involves formulating a hypothesis about program behaviour then testing these
hypotheses to find the system error
White box testing is called as glass box testing. It is a test case design method that uses the
control structure of the procedural design to the derive test cases.
Focused testing: The programmer can test the program in pieces. It’s much easier to give an
individual suspect module a through workout in glass box testing than in black box testing.
Testing coverage: The programmer can also find out which parts of the program are exercised
by any test. It is possible to find out which lines of code, which branches, or which paths haven’t
yet been tested.
www.vidyarthiplus.com Page 15
www.vidyarthiplus.com
Control flow: The programmer knows what the program is supported to do next, as a function
of its current state.
Data integrity: The programmer knows which parts of the program modify any item of data. By
tracking a data item through the system.
Internal boundaries: The programmer can see internal boundaries in the code that are
completely invisible to the outside tester.
Algorithmic specific: The programmer can apply standard numerical analysis techniques to
predict the results.
The basis path method enables the test case designer to derive a logical complexity measure of
a procedural design and use this measure as a guide for defining and use this measure as a guide for
defining a basis set of execution paths.
Flow graph is a simple notation for the representation of control flow. Each structured construct
has a corresponding flow graph symbol.
www.vidyarthiplus.com Page 16
www.vidyarthiplus.com
Each node that contains a condition is called a predicate node and is characterized by two or
more edges emanating from it.
Cyclomatic complexity:
Cyclomatic complexity is a software metric that provide a quantitative measure of the logical
complexity of a program.
The value computed for cyclomatic defines the number of independent paths in the basis set of
a program and provides us with an upper bound for the number of tests that must be conducted to
ensure that all statements have been executed at least once.
1. The number of regions of the flow graph corresponds to the cyclomatic complexity.
E is the number of the flow graph edges; N is the number of flow graph nodes.
V (G) = P+1
www.vidyarthiplus.com Page 17
www.vidyarthiplus.com
The basis path testing method can be applied to procedural design or to source code.
1. Using the design or code as a foundation draw a corresponding flow graph. A flow graph is
created using the symbols and construction rules.
2. Determine the cyclomatic complexity of the resultant flow graph. V (G) is determined by
applying the above algorithms.
3. Determine a basis set of linearly independent paths. The value of V (G) provides the number of
linearly independent paths through the program control structure.
Condition testing is a test case design method that exercises the logical conditions contained in
a program module.
The condition testing method focuses on testing each condition in the program.
2. The test coverage of conditions in a program provides guidance for the generation of additional
tests for the program.
Branch testing: This is the simplest condition testing strategy. For a compound condition C,
the true and false branches of C and every simple condition in C need to be executed at
least once.
Domain testing: This requires three or four tests to be derived for a relational for a
relational expression.
BRO (branch and relational operator) testing: This technique guarantees the detection of
branch and relational operator errors in a condition provided that all Boolean variable and
relational operators in condition occur only once.
The data flow testing method selects test paths of a program according to the locations of
definitions and uses of variable in the program.
www.vidyarthiplus.com Page 19
www.vidyarthiplus.com
If statement S is an if or loop statement, its DEF set is empty and its USE set is based on the
condition of statement S.
A definition use (DU) chain of variable X is of the form {X, S, S’] where S and S’ are statement
numbers, X is in DEF(S) and USE(S’) and the definition of X in statements S is live at statement S’.
One simple data flow testing strategy is to require that every DU chain be covered at least once.
Data flow testing strategies are useful for selecting test paths for a program containing nested if
and loop statements.
Since the statements in a program are related to each other according to the definitions and
uses of variable the data flow testing approach is effective for error detection.
Problem:
Measuring test coverage and selecting test paths for data flow testing are more difficult.
Loop testing is a white box testing technique that focuses exclusively on the validity of loop
constructs.
www.vidyarthiplus.com Page 20
www.vidyarthiplus.com
1. Simple loops
2. Nested loops
3. Concatenated loops
4. unstructured loops
Simple loops:
Nested loops: The number of possible tests would grow geometrically as the level of nesting
increases.
2. Conduct simple loop tests for the innermost loop while holding the outer loops at their
minimum iteration parameter values.
3. Work outward, conducting tests for the next loop, but keeping all other outer loops at minimum
value and other nested loops to typical values.
www.vidyarthiplus.com Page 21
www.vidyarthiplus.com
Concatenated loops:
Concatenated loops can be tested using the approach defined for simple loops, if each of the
loops is independent of the other. However, if two loops are concatenated and the loop counter for loop
1 is used as the initial value for loop2.
Unstructured loops:
Whenever possible, this class of loops would be redesigned to reflect the use of the structured
programming constructs.
Black box testing is also called as behavioral testing. This focuses on the functional requirements
of the s/w. Black box testing enables the s/w engineer to derive sets of input conditions that will
fully exercise all functional requirements for a program.
2. interface errors
www.vidyarthiplus.com Page 22
www.vidyarthiplus.com
1. Equivalent partitioning
3. comparison testing
1. EQUIVALENCE PARTITIONING:
It is a black box testing method that divides the inputs domain of a program into classes of data
from which test cases can be derived.
Test case design for equivalence partitioning is based on an evaluation of equivalence classes for
an input condition.
The input data to a program usually fall into number of different classes. These classes have
common characteristics, for example positive numbers, negative numbers strings without blanks
www.vidyarthiplus.com Page 23
www.vidyarthiplus.com
and so on. Programs normally behave in a comparable way for all members of a class. Because of
this equivalent behavior, these classes are sometimes called equivalent partitions or domains.
1. If an input condition specifies a range, one valid and two invalid equivalence classes are defined.
2. If an input condition requires a specific value, one valid and two invalid equivalence classes are
defined.
3. If an input condition specifies a member of a set one valid and one invalid equivalence class are
defined.
4. If an input condition is Boolean, one valid and one invalid class are defined.
Test cases for each input domain data item can be developed and executed by applying the
guidelines for the derivation of equivalence classes.
When reliability of software is absolutely critical, redundant hardware and s/w are often used to
minimize the possibility of error. In such situations, each version can be tested with the same test data
to ensure that all provide identical output. Those independent versions from the basis of a black box
testing technique called comparison testing.
If the output from the each version is the same, it is assumed that all implementations are
correct. If the output is different, each of the applications is investigated to determine if a defect in one
or more versions is responsible for the difference.
www.vidyarthiplus.com Page 24
www.vidyarthiplus.com
1. Comparison testing is not foolproof. If the specification from which all versions have been
developed is in error, all versions will likely reflect the error.
2. If each of the independent versions produces identical but incorrect results, condition testing
will fail to detect the error.
Orthogonal testing can be applied to problems in which the input domain is relatively small but
too large to accommodate exhaustive testing. The orthogonal array testing method is particularly
useful in finding errors associated with regions faults an error category associated with faulty logic
within a software component.
When orthogonal array testing occurs, an L9 orthogonal array of test cases is created. The L9
orthogonal array has a balancing property. That is test cases are dispersed uniformly throughout the
test domain.
The orthogonal array testing approach enables us to provide good test coverage with fewer test
case than the exhaustive strategy.
www.vidyarthiplus.com Page 25
www.vidyarthiplus.com
A great number of errors tend to occur at the boundaries of the input domain rather than in the
center. So boundary value analysis (BVA) derives test cases from the output domain as well.
1. If an input condition specifies a range bounded by values a and b, test cases should be designed
with values a and b and just above and just below a and b.
2. If an input condition specifies a number of values, test cases should be developed that exercise
the minimum and maximum numbers.
4. If internal program data structures have prescribed boundaries, be certain to design a test case
to exercise the data structure at its boundary.
www.vidyarthiplus.com Page 26
www.vidyarthiplus.com
Test data
Tests Derives
Component Test
code outputs
Static measurement- tools that analyze source code without executing test cases.
www.vidyarthiplus.com Page 27
www.vidyarthiplus.com
Test management – tools that assist in the planning, development, and control of testing.
Cross functional tools – tools that cross the bounds of the preceding categories.
www.vidyarthiplus.com Page 28