Pdf.2 Flashcards
independent paths in the code at least once.
☞ ______________
- logical decisions on their true and false sides.
☞ ______________ - loops at their boundaries and within their bounds.
☞ ___________ - internal data structures to ensure their validity.
☞ _____________
Basis Path Testing
Condition Testing
Loop Testing
Data Flow Testing
__________ executes the true and false value of each simple logical condition in a component
Condition testing
WHITE BOX TESTING: CONDITION TESTING
Errors in a condition result from errors in:
____________ - (a rel-op b) where rel-op={<, ≤, =, ≠, ≥, >}
may be negated with NOT, e.g., a≤b; NOT(a≤b)
__________ two or more simple conditions connected with
AND, OR, e.g., (a>b) AND (c<d)
______________ (E1 rel-op E2) where E1 and E2 are arithmetic
expressions, e.g., ((a*b+c)>(a+b+c))
____________ non relational expressions (e.g., NOT A)
simple condition
compound condition
relational expression
Boolean expression
WHITE BOX TESTING: CONDITION TESTING
_____________
For a compound condition C, test true and false branches of C
and every simple condition of C.
e.g., for C = (a>b) AND (c<d) we test for:
C TRUE and FALSE
a>b TRUE and FALSE
c<d TRUE and FALSE
Branch testing
WHITE BOX TESTING: CONDITION TESTING
___________
For an expression E1 rel-op E2, we test using values that make:
E1 greater than E2, E1 equal to E2, and E1 less than E2.
– This guarantees detection of rel-op error if E1 and E2 are _______.
– To detect errors in E1 and E2, the difference between E1 and E2 for
the tests that make E1 greater than E2 and E1 less than E2 should be
as ______ as possible.
Domain testing
correct
small
WHITE BOX TESTING: LOOP TESTING
Simple Loops (n iterations)
1. 0, 1, 2 passes through the loop.
2. m passes through the loop where m<n.
3. n-1, n, n+1 passes through the loop.
executes loops at and within their bounds.
Loop testing
WHITE BOX TESTING: LOOP TESTING(
Simple Loops (n iterations)
1. ______ passes the loop.
2. ______ passes through the loop where m<n.
3. ________ passes through the loop.
0, 1, 2
m
n-1, n, n+1
WHITE BOX TESTING: LOOP TESTING(
Nested Loops
1. Conduct _________ for the innermost loop while holding the outer loops at their minimum iteration values.
- Work ______, conducting simple loop tests for the next innermost loop.
- Continue until all the loops have been tested.
Tests grow ____________ with level of nesting!
simple loop tests
outward
geometrically
WHITE BOX TESTING: LOOP TESTING
3. Concatenated Loops
☞If loops are independent
→ use __________
☞If loops are dependent (i.e., a loop depends
on a variable set in another loop)
→ use __________
simple loop testing
nested loop testing
WHITE BOX TESTING: LOOP TESTING
. Unstructured Loops
☞Refactor the code!!!
These _______ have the highest likelihood of uncovering
errors with the minimum amount of effort and test overlap.
loop test
WHITE BOX TESTING: DATA FLOW TESTING
_________ ensures that the value of a variable is
correct at certain points of execution in the code.
Select test paths according to the locations of
definitions (S) and uses (S’) of a variable (X)
____ is the set of [X, S, S´] where X is
not redefined between S and S´.
A testing strategy: Every DU chain must be covered ______.
For every variable, do a test along the path from where the
variable is _______ to the statement(s) where the variable is used.
These tests can be combined with _______
Data flow testing
Definition Use (DU) Chain (X)
once
defined
basis path testing
DESIGN TESTS: BLACK BOX TESTING
Black box tests attempt to find:
– _________ functions
– ___________ errors
– __________________ errors
– _________ errors
– ___________ errors
To achieve reasonable testing, a black box test case should cover a
_____________, not just a single value. That is, it
should tell us something about the presence or ________ of a class
of errors (e.g., all character data is correctly/incorrectly processed).
incorrect or missing
interface incompatibility
data structure or external database access
performance
initialization and termination
range of input or output values
absence
EQUIVALENCE PARTITIONING
__________ creates subdomains by grouping inputs
and outputs by type to create test coverage of a class of errors.
Divide the input/output data of a component into partitions of
equivalent data.
The equivalence partitions are usually derived from the
requirements specification.
Test cases are designed to cover each equivalence partition at
least once.
A COMMON PARTITIONING HEURISTIC
Select subdomains based on _______ inputs/outputs.
For testing, select “______” values “inside” a subdomain.
Equivalence partitioning
valid and invalid
typical
EQUIVALENCE PARTITIONING:
SUBDOMAIN SELECTION HEURISTICS
If the input is a ______ → one valid and two invalid subdomains:
invalid: less than range
valid: in range
invalid: greater than range
If the input is a _______ → one valid and two invalid subdomains:
invalid: less than specific value
valid: specific value
invalid: greater than specific value
If the input is a set of _________ → one valid and one invalid subdomain:
invalid: not member of set
valid: member of set
If the input is ___________ → one valid and one invalid subdomain:
invalid: non-Boolean
valid: Boolean
range
specific value
related values
Boolean
BOUNDARY TESTING
More errors occur at the ________
of a subdomain than in the “center”.
Why?
– off-by-one bugs
– forget to handle empty container/null object
– overflow errors in arithmetic
– program does not handle aliasing of objects
Small subdomains at the “boundaries” of the main subdomains
have a ________ probability of revealing these common errors.
For testing, select values at the
_______ of a main subdomain.
“boundaries”
high
“boundaries”
BOUNDARY TESTING:
TEST VALUE SELECTION HEURISTICS
1. If the input is a ________ and is bounded by a and b, then use a, b, and
values just above and just below a and b, respectively.
- If the input is a number of _____ values, use the minimum and the
maximum of the values and values just above and just below them,
respectively. (Can also be applied to a single specific input value.)
3.If the input is a __________, test all values in the set (if possible) and
one value outside the set
range
discrete
set of values
BOUNDARY TESTING:
TEST VALUE SELECTION HEURISTICS
- If the input is a ________, test for both Boolean values (T, F) and for a
non-Boolean value. - Apply guidelines 1 and 2 to create output values at the minimum and
maximum expected values.
E.g., if the output is a table, create a minimum size table (1 row) and a
maximum size table. - If data structures have _______, test these boundary values and
values just above and just below them, respectively.
E.g., for an array with bounds 1 to 10 → test array index = 0, 1, 2, 9, 10, 11.
Boolean
boundaries
BLACK BOX TESTING: STATE-BASED TESTING
Some programs can be in many different states simultaneously.
THREAD TESTING
object oriented systems.
BLACK BOX TESTING: STATE-BASED TESTING
Some programs can be in many different states simultaneously.
BLACK BOX TESTING: STATE-BASED TESTING
________ focuses on comparing the resulting state of
a class with the expected state.
☞ Derive test cases using ___________ for a class.
Derive a representative set of __________ for each
transition (similar to equivalence testing).
Check the _________ or links of the class after applying a
“stimuli” to determine if the specified state has been reached.
☞ We first need to put the class in the desired state
before applying the “stimuli”.
State-based testing
state machine diagram
“stimuli” (events)
attributes
REGRESSION TESTING
Whenever you find a bug:
– _________ it (before you fix it).
– Record the _____________.
– Record the _________.
– Put everything into the ________
– Then, ___________.
Why is this a good idea?
– It helps to populate the test suite with good tests.
– It protects against changes that reintroduce the bug.
☞It happened once, so it might happen again!
Reproduce
input that produced that bug
correct output
test suite.
fix the bug and verify the fix