Professional Documents
Culture Documents
Testing
• Requirements-based testing
• Positive and negative testing
• Boundary value analysis
• Decision tables
• Equivalence partitioning
• State-based testing
• Compatibility testing
• User documentation testing
• Domain testing (leads to ad hoc testing)
Equivalence Class Partitioning
• black box with well- defined inputs and outputs, a good
approach to selecting test inputs is to use a method
called equivalence class partitioning
• important points related to equivalence class partitioning
• The tester must consider both valid and invalid
equivalence classes.
• Equivalence classes may also be selected for output
conditions.
• The derivation of input or outputs equivalence classes is
a heuristic process
• In some cases it is difficult for the tester to identify
equivalence classes. The conditions/boundaries that help
to define classes may be absent,
List of Conditions
• If an input condition for the software-under-test is specified
as a range of values, select one valid equivalence class that
covers the allowed range and two invalid equivalence
classes, one outside each end of the range.
• valid equivalence class that contains all the members of the
set and one invalid equivalence class for any value outside
the set.‘‘
• If an input condition for the software-under-test is specified
as a “must be” condition, select one valid equivalence class
to represent the must be condition and one invalid class
that does not include the “must be condition”
• If an input condition for the software-under-test is specified
as a set of valid input values, then select one valid
equivalence class that contains all the members of the set
and one invalid equivalence class for any value outside the
set
• equivalence class is not handled - then the class should be
further partitioned into smaller equivalence classes.‘‘
Function square_root
message (x:real)
when x >_0.0
reply (y:real)
where y >_0.0 & approximately (y*y,x)
otherwise reply exception imaginary_square_root
end function
input equivalence classes for this module are the following:
EC1. The input variable x is real, valid.
EC2. The input variable x is not real, invalid.
EC3. The value of x is greater than 0.0, valid.
EC4. The value of x is less than 0.0, invalid.
After the equivalence classes have been identified the next
step in test case design - following steps.
• Each equivalence class should be assigned a unique
identifier.
• Develop test cases for all valid equivalence classes until all
have been covered by (included in) a test case.
• Develop test cases for all invalid equivalence classes until
all have been covered individually.
Boundary value analysis (Eg : unit payment)
• The test cases developed based on equivalence class
partitioning can be strengthened by use of an
technique called boundary value analysis.
• The rules-of-thumb
– If an input condition for the software-under-test is
specified as a range of values, develop valid test
cases for the ends of the range, and invalid test
cases for possibilities just above and below the
ends of the range.
– If an input condition for the software-under-test is
specified as a number of values, develop valid test
cases for the minimum and maximum numbers as
well as invalid test cases that include one lesser and
one greater than the maximum and minimum.
• If the input or output of the software-under-test
is an ordered set, such as a table or a linear list,
develop tests that focus on the first and last
elements of the set. It is important for the tester
to keep in mind that equivalence class
partitioning and boundary value analysis apply
to testing both inputs and output.
Positive & Negative testing
– Positive testing checks the product
with collection of expected output.
– Negative task demonstrate that the
product doesn't fail when
unexpected data is given
Decision Table (Tax/ Claims)
• List of decision variable
• Condition for every decision variable
• Actions to be done in each
combination of condition.
Decision table creation - steps
• Decision variable found
• Find the values of every decision variable
• Create the combination of values of decision variables
• Identify the cases when values assumed by a variable are
immaterial for the given combination - denoted by “don’t
care” symbol.
• From a table, listing in each, the last column list the action
item expressed in boolean – “true , false r don’t care”.
State based / Graph based testing
• Internal configuration of a system or component
• It is based on the concepts of states and finite-state
machines.
• Moderator
– Controls the meeting(s)
• Inspectors (reviewers)
– Prepare by reading the required documents
– Take part in the meeting(s) and report defects
• Scribe
– Takes down notes during the meeting
– Assigned in advance by turns
– Can participate to review to the extent possible
– Documents the minutes and circulates them to
participants
Process in a Fagan Inspection
3 while
7 8
9
Structural testing
• Takes into account the code, code structure, internal design
and how they are coded.
• It’s the actual run by the computer on the built product.
Types:
• Unit functional testing
• Code coverage testing
• Code complexity testing.
Unit /code functional test
• Initially by knowing the i/p and o/p the tester does a
quick test – checks mistakes
• Modules with logic or condition, the developer can
build a “debug version” by placing some
intermediate statements – assure those intermediate
statements are removed later
• To run the product under debugger or IDE – allows
the developer to stop at the end of each instruction,
view and modify the contents
Code Coverage Testing
• Exercises different parts of code
• Maps parts of code to required
functionality
• Finds out percentage of code
covered by “instrumentation”
• Instrumentation rebuilds the
product, linking it with libraries
• Instrumented code can monitor what
parts of code is covered
• Can help identify critical portions of
code, executed often
Types of Code Coverage
• Statement coverage
• Path coverage
• Condition coverage
• Function coverage
All structured programs can be built from three basic
primes
– sequential (e.g., assignment statements)
– decision (e.g., if/then/else statements)
– and iterative (e.g., while, for loops).
Sequential Coverage
• module is executed 100%
• when the module is executed, all (100%) of
the statements in the module are executed at
least once.
{
s=0
a=0
While (a<b)
a=a+2
b=b-4
if (a<20)
s=s+a+b
else
s=s+a-b
}
PATHS – THEIR ROLE IN WHITE BOX TESTING
• Flow graph is constructed by using tools – used to calculate
complexity measure
CYCLOMATIC COMPLEXITY
• Attribute for the tester, to find the approximate number of test
cases required for the branch coverage
• From the flow graph it is calculated
• Formula V(G) = E – N + 2
where v(g) - complexity
E – number of edges
N – number of nodes in flow graph
PATH
it is the collection of flow nodes starting from entry to exit
node.
INDEPENDENT PATH
It is any path through the program that introduces at least
one new set of processing statement or a new condition.
• A collection of independent paths is termed as BASIS SET.
• The number of independent path in basis set is equal to
cyclomatic complexity of flow graph
So complete coverage for path cannot be obtained:
– The basis set is a special set of paths
– It doesn’t represent all the path in a module
– This can be used for getting decision coverage
CODE COMPLEXITY TESTING
Testing type in which complexity measure is calculated