Sum m ary of Sum m ary of Test Case Design Techniques Brian - - PowerPoint PPT Presentation

sum m ary of sum m ary of test case design techniques
SMART_READER_LITE
LIVE PREVIEW

Sum m ary of Sum m ary of Test Case Design Techniques Brian - - PowerPoint PPT Presentation

Sum m ary of Sum m ary of Test Case Design Techniques Brian Nielsen, Arne Skou {bnielsen | ask}@cs.auc.dk Developm ent of Test Cases Complete testing is impossible ologi Testing cannot guarantee the absence of faults tekno


slide-1
SLIDE 1

Sum m ary of Sum m ary of Test Case Design Techniques

Brian Nielsen, Arne Skou

{bnielsen | ask}@cs.auc.dk

slide-2
SLIDE 2

Developm ent of Test Cases

Complete testing is impossible

  • logi

Testing cannot guarantee the absence of faults

tekno 

How to select subset of test cases from all possible test cases

tionst

How to select subset of test cases from all possible test cases with a high chance of detecting most faults ?

  • rmat

Test Case Design Strategies

Info

CISS

slide-3
SLIDE 3

W hitebox Testing Overview

 White box testing

  • logi

 White box testing

 Flowgraphs  Test criteria/coverage

St t t / b h / d i i / diti / th

tekno

  • Statement / branch / decision / condition / path coverage
  • MC/DC coverage

 Looptesting

tionst

 Def-use pairs  Efficiency of different criteria

  • rmat

BEW ARE: Expected outcome cannot be determined from

Info

code!

CISS

slide-4
SLIDE 4

W hite-Box : Statem ent Testing

 Execute every statement of a program  Relatively weak criterion

  • logi

 Relatively weak criterion  Weakest white-box criterion

tekno tionst

  • rmat

Info

CISS

slide-5
SLIDE 5

Exam ple : Statem ent Testing ( result

= 0 + 1 + …+ | value| , if this < = m axint, error otherw ise)

  • logi

1 PROGRAM maxsum ( maxint, value : INT ) 2 INT result := 0 ; i := 0 ;

tekno

3 IF value < 0 4 THEN value := - value ; 5 WHILE ( i < value ) AND ( result < maxint )

tionst

5 WHILE ( i < value ) AND ( result <= maxint ) 6 DO i := i + 1 ; 7 result := result + i ;

  • rmat

7 result := result + i ; 8 OD; 9 IF result <= maxint

Info

9 IF result maxint 10 THEN OUTPUT ( result ) 11 ELSE OUTPUT ( “too large” )

CISS

12 END.

slide-6
SLIDE 6

Flow grah

1 2

Node = statement (blocks) Edges = possible successor (control flow)

  • logi

1 PROGRAM maxsum ( maxint, value : INT ) 2 INT result := 0 ; i := 0 ; 3 IF l

3 4

tekno

3 IF value < 0 4 THEN value := - value ; 5 WHILE ( i < value ) AND ( result <= maxint ) 6 DO i i + 1

5 6-7

tionst

6 DO i := i + 1 ; 7 result := result + i ; 8 OD; 9 IF result <= maxint

  • rmat

9 IF result <= maxint 10 THEN OUTPUT ( result ) 11 ELSE OUTPUT ( “too large” ) 12 END

9

Info

12 END.

10 11

CISS

12

slide-7
SLIDE 7

Flow graph: Cyclomatic complexity

# edges - # nodes + 2

Defines the maximal number of test cases needed to provide statement coverage

  • logi

provide statement coverage

Mostly applicable for Unit testing

Strategy for statement coverage:

tekno

gy g

1.

Derive flow graph

2.

Find cyclomatic complexity # c

3

Determine at most # c independent paths through the

tionst

3.

Determine at most # c independent paths through the program (add one new edge for each test case)

4.

Prepare test cases covering the edges for each path ( ibl f th # )

  • rmat

(possibly fewer than # c cases)

Info

CISS

slide-8
SLIDE 8

Cyclomatic complexity?

1

y p y

1 PROGRAM maxsum ( maxint, value : INT ) 2 INT lt i

2

  • logi

2 INT result := 0 ; i := 0 ; 3 IF value < 0 4 THEN value := - value ; 5 WHILE ( i < l ) AND ( lt < i t )

3 4

tekno

5 WHILE ( i < value ) AND ( result <= maxint ) 6 DO i := i + 1 ; 7 result := result + i ; 8 OD;

5 6-7

tionst

8 OD; 9 IF result <= maxint 10 THEN OUTPUT ( result ) 11 ELSE OUTPUT ( “too large” )

  • rmat

11 ELSE OUTPUT ( too large ) 12 END.

9

Info

10 11

CISS

12

slide-9
SLIDE 9

Exam ple : Statement Testing

start

yes

  • logi

value:= -value; value < 0 yes no

tekno

Tests for complete statement coverage:

i:=i+1; result:=result+i;

tionst

g maxint value

(i<value) and (result<=maxint) yes

  • rmat

10

  • 1
  • 1

no yes no

Info

result<=maxint

  • utput(result);
  • utput(“too large”);

yes no

CISS

  • utput(result);
  • utput( too large );

exit

slide-10
SLIDE 10

W hite-Box : Path Testing

 Execute every possible path of a program,

i e every possible sequence of statements

  • logi

i.e., every possible sequence of statements

 Strongest white-box criterion

tekno

 Usually impossible: infinitely many paths ( in case of loops )  So: not a realistic option

tionst

 But note : enormous reduction w.r.t. all possible test cases

( each sequence of statements executed for only one value )

  • rmat

( eac seque ce o s a e e s e ecu ed o o y o e a ue )

Info

CISS

slide-11
SLIDE 11

W hite-Box : Branch Testing

 Branch testing == decision testing

  • logi

 Execute every branch of a program :

each possible outcome of each decision occurs at least once

tekno

 Example:

 IF b THEN s1 ELSE s2

tionst

 IF b THEN s1; s2  CASE x OF

  • rmat

1 : …. 2 : …. 3

Info

3 : ….

CISS

slide-12
SLIDE 12

Exam ple : Branch Testing

Tests for complete

start

yes

  • logi

statement coverage: maxint value 10 1

value < 0 value:= -value; yes no value < 0

tekno

10

  • 1
  • 1

is not sufficient for

i:=i+1; result:=result+i;

tionst

is not sufficient for branch coverage;

(i<value) and (result<=maxint) yes

T k

  • rmat

no yes no

Take: maxint value 10 3

Info

result<=maxint

  • utput(result);
  • utput(“too large”);

yes no

10 3

  • 1

for complete

CISS

  • utput(result);
  • utput( too large );

exit

branch coverage

slide-13
SLIDE 13

Exam ple : Branch Testing

l l l < 0

start

yes

maxint value

  • logi

value:= -value; value < 0 yes no

maxint value

  • 1
  • 1
  • 1
  • 1

10 3

  • 1
  • 1

tekno

i:=i+1; result:=result+i;

10 3 But: 10 3

tionst

(i<value) and (result<=maxint) no yes

But: No green path !

  • rmat

lt< i t no yes no

Needed :

Info

result<=maxint

  • utput(result);
  • utput(“too large”);

yes

  • Combination of decisions

10

  • 3

CISS

p ( ); p (

g

);

exit

slide-14
SLIDE 14

W hite-Box : Condition Testing

 Design test cases such that each possible outcome

f

  • logi
  • f each condition in each decision occurs at least once

 Example:

tekno

 decision ( i < value ) AND (result <= maxint )

consists of two conditions : ( i < value ) AND (result <= maxint ) t t h ld b d i d h th t h t l

tionst

test cases should be designed such that each gets value true and false at least once

  • rmat

Info

CISS

slide-15
SLIDE 15

Exam ple : Condition Testing

start

yes

  • logi

( i = result = 0 ) : maxint value i<value result<=maxint

value:= -value; value < 0 yes no

tekno

  • 1 1 true false

1 0 false true i diti

i:=i+1; result:=result+i;

tionst

gives condition coverage for all conditions

(i<value) and (result<=maxint) yes

But it does not preserve

  • rmat

no yes no

But it does not preserve decision coverage

Info

result<=maxint

  • utput(result);
  • utput(“too large”);

yes no

always take care that condition coverage preserves decision coverage :

CISS

  • utput(result);
  • utput( too large );

exit

preserves decision coverage : decision / condition coverage

slide-16
SLIDE 16

W hite-Box : Multiple Condition Testing

 Design test cases for each combination of conditions

Testing

  • logi

 Example:

 ( i < value )

(result <= maxint )

tekno

 ( i

value ) (result maxint ) false false false true t f l

tionst

true false true true

 Implies decision- condition- decision/condition coverage

  • rmat

 Implies decision-, condition-, decision/condition coverage  But : exponential blow-up  Again : some combinations may be infeasible

Info

 Again : some combinations may be infeasible

CISS

slide-17
SLIDE 17

W hite-box: loop testing

 Statement and branch coverage are not sufficient  Single loop strategy:

Zero iterations

  • logi

 Zero iterations  One iteration  Two iterations

l b f

tekno

 Typical number of iterations  n-1, n, and n+ 1 iterations (n maximum number of

allowable iterations)

d l

tionst

 Nested loop strategy:

 Single loop strategy often intractable  Select minimum values for outer loop(s)

  • rmat

 Treat inner loop as a single loop  Work ‘outwards’ and choose typical values for inner loops

 Concatenated loops:

Info

 Concatenated loops:

 Treat as single, if independent  Treat as nested, if dependent

CISS

slide-18
SLIDE 18

Exam ple : Loop testing

start

yes

Tests for complete loop coverage:

  • logi

value < 0 value:= -value; yes no

maxint value 15

tekno

i:=i+1; result:=result+i;

15 15 1 15 2

tionst

(i<value) and (result<=maxint) yes

15 3 6 4

  • rmat

no yes no

15 5

Info

result<=maxint

  • utput(result);
  • utput(“too large”);

yes no

CISS

  • utput(result);
  • utput( too large );

exit

slide-19
SLIDE 19

W hite-box testing: Data Flow Criteria

 Basic idea: For each variable definition (assignment), find

a path (and a corresponding test case), to its use(s). A

  • logi

a path (and a corresponding test case), to its use(s). A pair (definition,use) is often called a DU pair.

 Three dominant strategies:

ll d f ( ) f ll l h f h

tekno

 All-defs (AD) strategy: follow at least one path from each

definition to some use of it

 All-uses (AU) strategy: follow at least one path for each DU

tionst

pair

 All-du-uses strategy (ADUP): follow all paths between a DU

pair

  • rmat

 Complements the testing power of decision coverage

Info

CISS

slide-20
SLIDE 20

Exam ple: All-uses coverage

1

Dm,v

1 PROGRAM maxsum ( maxint, value : INT ) 2 INT result := 0 ; i := 0 ; 3 IF value < 0

2

Dr,i

  • logi

4 THEN value := - value ; 5 WHILE ( i < value ) AND ( result <= maxint ) 6 DO i := i + 1 ;

3 4

Uv Uv;Dv

tekno

7 result := result + i ; 8 OD; 9 IF result <= maxint 10 THEN OUTPUT ( lt )

5 6-7

Ui v r m Ur,i;Dr,i

tionst

10 THEN OUTPUT ( result ) 11 ELSE OUTPUT ( “too large” ) 12 END.

5 6

i,v,r,m

  • rmat

9

Ur,m Def-use pairs: 1 3 1 5 1 9 1 4 Tests for complete all-uses coverage: i t l

Info

10 11

Ur 1-3,1-5,1-9,1-4 2-5,2-9,2-6 4-5 maxint value

  • 1

CISS

12

6-5,6-9,6-11 6-5-6 10 1 10 2

slide-21
SLIDE 21

W hite-Box : Overview

statement coverage

  • logi

condition coverage decision (branch) coverage

tekno

decision/ condition coverage

tionst

multiple- condition

  • rmat

condition coverage

Info

path coverage

CISS

slide-22
SLIDE 22

W hite-Box : Overview

statement coverage f decision

  • logi

all defs coverage decision (branch) coverage

tekno

all uses coverage

tionst

all du paths coverage

  • rmat

path coverage

Info

path coverage

CISS

slide-23
SLIDE 23

Additional techniques: m utation and random testing and random testing

 Mutation testing:

 Intended for evaluating the test cases

  • logi

 Intended for evaluating the test cases  Create at set of slightly modified mutants of the original

program containing errors R th t t i t th t t

tekno

 Run the test cases against the mutants  Criteria

  • All mutants must fail (strong)

tionst

  • All mutants will eventually fail (weak)

 Random testing:

 Basic idea: run the program with arbitrary inputs

  • rmat

 Basic idea: run the program with arbitrary inputs  Inherent problems: How to define the oracle for

arbitrary inputs and how to decide to stop?

Info

 Advantage: The program structure can be ignored

CISS

slide-24
SLIDE 24

Efficiency of white box techniques: Efficiency of white-box techniques: two studies

  • logi

Strategy #test cases %bugs found Random 35 93 7

tekno

Random 35 93.7 Branch 3.8 91.6 All 11 3 96 3

tionst

All-uses 11.3 96.3

  • rmat

Random 100 79.5

Info

Branch 34 85.5 All-uses 84 90 0

CISS

All-uses 84 90.0

slide-25
SLIDE 25

W hat is MC/ DC?

 MC/ DC stands for Modified

  • logi

Condition / Decision Coverage

 Main idea: Each condition must be

h t i d d tl ff t th tekno shown to independently affect the

  • utcome of a decision, i.e. the
  • utcome of a decision changes as a

tionst

  • utcome of a decision changes as a

result of changing a single condition.

  • rmat

Info

CISS

slide-26
SLIDE 26

1 . MC/ DC Requirem ent

 The decision has taken all possible

  • utcomes at least once.
  • logi

If ((a) & (b) | (c)) then

tekno

If ((a) & (b) | (c)) then…

tionst

true false

  • rmat

 We could also say we cover both the true

d h f l b h (lik d i Info and the false branch (like we do in Branch Testing).

CISS

slide-27
SLIDE 27

2 . MC/ DC Requirem ent

 Every condition in the decision has taken

all possible outcomes at least once.

  • logi

p

If ((a) & (b) | (c)) then…

tekno

If ((a) & (b) | (c)) then…

true false true false true false

tionst

 Aims to cover compound conditions (like

  • rmat

p ( Condition/ Decision Coverage) Info

CISS

slide-28
SLIDE 28

3 . MC/ DC Requirem ent

 Every condition in the decision

i d d tl ff t th d i i ’

  • logi

independently affects the decision’s

  • utcome.

tekno

If ((a) & (b) | (c)) then…

tionst

(( ) ( ) | ( ))

true false true false

  • rmat

Change the value of each condition individually while keeping all other conditions constant.

Info

CISS

slide-29
SLIDE 29

Creating MC/ DC test cases

If (A and B) then…

  • logi

 (1) create truth table for conditions

tekno

 (1) create truth table for conditions.  (2) Extend truth table so that it

indicated which test cases can be used tionst indicated which test cases can be used to show the independence of each condition.

  • rmat

Info

CISS

slide-30
SLIDE 30

Creating MC/ DC test cases cont’d

  • logi

 Show independence of

A:

Take 1 + 3

tekno

 Take 1 + 3

 Show independence of

B:

tionst

B:

 Take 1 + 2

 Resulting test cases

  • rmat

g are

 1 + 2 + 3

(T T) (T F) (F T)

Info

 (T , T) + (T , F) + (F , T)

CISS

slide-31
SLIDE 31

More advanced exam ple

If (A and (B or C)) then…

  • logi

tekno

Note: We want to determine the MINIMAL set of test cases H

tionst

Here: {2,3,4,6} {2,3,4,7}

  • rmat

Non-minimal set is: {1,2,3,4,5}

Info

CISS

slide-32
SLIDE 32

Argum ent in the softw are industry

 Federal Aviation Administration’s

requirement that test suites be MC/ DC

  • logi

q / adequate (DO-178B). tekno

 In the avionics domain, complex Boolean

expressions are much more common tionst expressions are much more common.

  • rmat

Info

CISS

slide-33
SLIDE 33

Argum ent in the softw are industry

 Federal Aviation Administration’s requirement

that test suites be MC/ DC adequate.

 Argument – Too expensive

  • logi

 Argument – Too expensive

 “For example, one of our industrial partners reports

that for one of its products of about 20,000 lines of code the MC/ DC-adequate test suite requires seven

tekno

code, the MC/ DC-adequate test suite requires seven weeks to run.”

 Counter Argument – Significantly more effective

A t i i l t d f d d i th l

tionst

 A recent empirical study performed during the real

testing of the attitude-control software for the HETE-2 (High Energy Transient Explorer) found that the test cases generated to satisfy the MC/ DC coverage

  • rmat

cases generated to satisfy the MC/ DC coverage requirement detected important errors not detectable by functional testing.

Info

CISS

slide-34
SLIDE 34

Blackbox Testing Overview

 Black-box testing (or functional testing):

  • logi

Black box testing (or functional testing):

 Equivalence partitioning  Boundary value analysis

Domain analysis

tekno

y y

 Cause-effect graphing  Behavioural testing / state transition testing

y

tionst

 Random testing, Error guessing etc…  Others: Classification Tree Method, Pairwise testing, Use Case

  • rmat

Testing, Syntax testing, ..

 Basics : heuristics and experience

Info

 How to use black-box and white-box testing in combination

CISS

slide-35
SLIDE 35

Black box testing

requirements

  • logi
  • utput

tekno

SUT

input

tionst

put events

y domain testing

  • rmat

Info

x CISS x

slide-36
SLIDE 36

Black-box: Equivalence Partitioning

  • logi

Strategy :

 Identify input equivalence classes

tekno

y p q

 Based on conditions on inputs / outputs in specification / description  Both valid and invalid input equivalence classes

tionst

 Both valid and invalid input equivalence classes  Based on heuristics and experience

  • “input x in [1..10]”

 classes : x  1, 1  x  10, x  10

  • rmat
  • “enumeration A, B, C

 classes : A, B, C, not{A,B,C,}

  • ……..

Define one / couple of test cases for each class

Info

Define one / couple of test cases for each class

 Test cases that cover valid eq. classes  Test cases that cover at most one invalid eq class

CISS

 Test cases that cover at most one invalid eq. class

slide-37
SLIDE 37

Exam ple: Equivalence Partitioning

  • logi

 Test a function for calculation of absolute value of an integer  Equivalence classes :

tekno

 Equivalence classes :

Condition Valid eq. classes Invalid eq. Classes nr of inputs 1 > 1

tionst

nr of inputs 1 0, > 1 Input type integer non-integer particular abs < 0, >= 0

  • rmat
  • Test inputs :

Info

  • x = -10,

x = 100

  • x = “XYZ”, x = -

x = 10 20

CISS

slide-38
SLIDE 38

A Self-Assessm ent Test [ Myers]

 “A program reads three integer values. The three values are

interpreted as representing the lengths of the sides of a triangle.

  • logi

The program prints a message that states whether the triangle is scalene (uligesidet), isosceles (ligebenet) , or equilateral (ligesidet) ”

tekno

(ligesidet).

tionst

  • rmat

Write a set of test cases to test this program

Info

Write a set of test cases to test this program. CISS

slide-39
SLIDE 39

A Self-Assessm ent Test [ Myers]

Test cases for:

  • logi
  • 1. valid scalene triangle ?
  • 2. valid equilateral triangle ?

3 lid i l t i l ?

  • 9. one side larger than sum of
  • thers ?

10 3 permutations of previous ?

tekno

  • 3. valid isosceles triangle ?
  • 4. 3 permutations of previous ?

5 side = 0 ?

  • 10. 3 permutations of previous ?
  • 11. all sides = 0 ?
  • 12. non-integer input ?

tionst

  • 5. side = 0 ?
  • 6. negative side ?
  • 7. one side is sum of others ?
  • 12. non integer input ?
  • 13. wrong number of values ?
  • 14. for each test case: is
  • rmat
  • 7. one side is sum of others ?
  • 8. 3 permutations of previous ?

expected output specified ?

  • 15. check behaviour after

t t d d ?

Info

  • utput was produced ?

CISS

slide-40
SLIDE 40

Exam ple: Equivalence Partitioning

 Test a program that computes the sum of the first value integers

l thi i l th i t Oth i

  • logi

as long as this sum is less than maxint. Otherwise an error should be reported. If value is negative, then it takes the

tekno

absolute value

 Formally:

tionst

y Given integer inputs maxint and value compute result :

  • rmat

result = if this <= maxint, error otherwise

|value|

k

Info

K=0

CISS

slide-41
SLIDE 41

Exam ple: Equivalence Partitioning

 Equivalence classes :

Condition Valid eq. classes Invalid eq. classes N f i t 2 2 2

  • logi

Nr of inputs 2 < 2, > 2 Type of input int int int no-int, no-int int Abs(value) value  0, value  0 

tekno

maxint  k  maxint,  k > maxint

 Test Cases :

maxint value result

tionst

Test Cases :

maxint value result

Valid 100 10 55 100

  • 10

55 10 10

  • rmat

10 10 error Invalid 10

  • error

10 20 30 error

Info

“XYZ” 10 error 100 9.1E4 error

CISS

slide-42
SLIDE 42

Black-box: Boundary Value Analysis

  • logi

 Based on experience / heuristics :

 Testing boundary conditions of eq. classes is more effective

tekno

i.e. values directly on, above, and beneath edges of eq. classes

 Choose input boundary values as tests in input eq. classes

tionst

instead of, or additional to arbitrary values

 Choose also inputs that invoke output boundary values

( values on the boundary of output classes )

  • rmat

( values on the boundary of output classes )

 Example strategy as extension of equivalence partitioning:

  • choose one (n) arbitrary value in each eq class

Info

  • choose one (n) arbitrary value in each eq. class
  • choose values exactly on lower and upper boundaries of eq. class
  • choose values immediately below and above each boundary

( if applicable )

CISS

( if applicable )

slide-43
SLIDE 43

Exam ple: Boundary Value Analysis

  • logi

 Test a function for calculation of absolute value of an integer  Valid equivalence classes :

tekno

 Valid equivalence classes :

Condition Valid eq. classes Invalid eq. Classes particular abs < 0, >= 0

tionst

particular abs 0,

  • Test cases :
  • rmat

class x < 0, arbitrary value: x = -10 class x >= 0, arbitrary value x = 100

Info

classes x < 0, x >= 0, on boundary : x = 0 classes x < 0, x >= 0, below and above: x = -1, x = 1

CISS

slide-44
SLIDE 44

Exam ple: Boundary Value Analysis

 Given integer inputs maxint and value compute result :

|value|

  • logi

result = if this <= maxint, error otherwise

|value|

k

tekno

K=0

  • Valid equivalence classes :

tionst

Condition Valid eq. Classes Abs(value) value  0, value  0

  • rmat

maxint  k  maxint,  k > maxint

Sh ld l di ti i h b t i t d i t 0 ?

Info

  • Should we also distinguish between maxint < 0 and maxint >= 0 ?

maxint maxint < 0, 0  maxint <  k, maxint   k

CISS

slide-45
SLIDE 45

Exam ple: Boundary Value Analysis

  • logi

 Valid equivalence classes :

Abs(value) value  0, value  0

tekno

maxint maxint < 0, 0  maxint <  k, maxint   k

 Test Cases :

tionst

C

maxint value result maxint value result

55 10 55 100

  • rmat

55 10 55 100 54 10 error 100

  • 1

1 56 10 55 100 1 1

Info

…. …. …

  • 10

1 error

 How to combine the boundary conditions of different inputs ?

CISS

Take all possible boundary combinations ? This may blow-up.

slide-46
SLIDE 46

Black-box: Cause Effect Graphing

  • logi

 Black-box testing technique to analyse combinations

  • f input conditions

tekno

  • f input conditions

 Identify causes and effects in specification

 

tionst

 

inputs

  • utputs

current state new state

  • rmat

 Make Boolean Graph linking causes and effects

Info

 Annotate impossible combinations of causes and effects  Develop decision table from graph with in each column

a particular combination of inputs and outputs

CISS

a particular combination of inputs and outputs

 Transform each column into test case

slide-47
SLIDE 47

Black-Box: Cause Effect Graphing

 k  maxint  k i t  k

d xor

  • logi

 k  maxint value  0  error

and xor and

tekno

C  value  0

xor

tionst

Causes  k  maxint 1 1 inputs  k  maxint 1 1 value  0 1 1

  • rmat

value  0 1 1 value  0 1 1

Info

Effects  k 1 1

  • utputs

error 1 1

CISS

Testcase

slide-48
SLIDE 48

Black-box: Cause Effect Graphing

 Systematic method for generating test cases representing

combinations of conditions

  • logi

combinations of conditions

 Combinatorial explosion of number of possible combinations

S h i ti t d thi bi t i l l i

tekno

 Some heuristics to reduce this combinatorial explosion  Starting point is effects (outputs) then working ‘backwards’

tionst

 ‘light-weight’ formal methods:

transformation into semi-formal Boolean graph

  • rmat

 A technique : to be combined with others

Info

CISS

slide-49
SLIDE 49

Black-box: Error Guessing

 Just ‘guess’ where the errors are ……  Intuition and experience of tester

  • logi

 Intuition and experience of tester  Ad hoc, not really a technique

tekno

 Strategy:

 Make a list of possible errors or error-prone situations

tionst

( often related to boundary conditions )

 Write test cases based on this list

  • rmat

Info

CISS

slide-50
SLIDE 50

Black-box : Error Guessing

 More sophisticated ‘error guessing’ : Risk Analysis  Try to identify critical parts of program (high risk code sections):

  • logi

 Try to identify critical parts of program (high risk code sections):

 parts with unclear specifications

tekno

 developed by junior programmer while his wife was pregnant ……  complex code :

tionst

measure code complexity - tools available (McGabe, Logiscope,…)

 High-risk code will be more thoroughly tested

  • rmat

( or be rewritten immediately ….)

Info

CISS

slide-51
SLIDE 51

Black-Box Testing: W hich One ?

 Black-box testing techniques :

 Equivalence partitioning

  • logi

 Boundary value analysis  Cause-effect graphing

tekno

 Error guessing  ………

Whi h t ?

tionst

 Which one to use ?

 None is complete  All are based on some kind of heuristics

  • rmat

 All are based on some kind of heuristics  They are complementary

Info

CISS

slide-52
SLIDE 52

Black-Box Testing: Which One ?

 Always use a combination of techniques

  • logi

 When a formal specification is available try to use it  Identify valid and invalid input equivalence classes

tekno

 Identify output equivalence classes  Apply boundary value analysis on valid equivalence classes

tionst

 Guess about possible errors  Cause-effect graphing for linking inputs and outputs

  • rmat

Info

CISS

slide-53
SLIDE 53

White-Box testing : How to Apply ?

Don’t start with designing white-box test cases !

  • logi

Start with black-box test cases (because requirements must be tested anyway)

tekno

equivalence partitioning, boundary value analysis, cause effect graphing, test derivation with formal methods, ….. 

Check white box coverage

tionst

Check white-box coverage ( statement-, branch-, condition-, ….. coverage ) U

t l

b bi d ith U it f k

  • rmat

Use a coverage tool – maybe combined with a Unit framework

Design additional white-box test cases for not covered code

Info

CISS

slide-54
SLIDE 54

Blackbox vs. W hitebox

  • logi

I II III tekno tionst

  • rmat

Specified Behavior Implemented Behavior

Info

(Blackbox) (Whitebox)

I: Specified, not implemented II: Implemented and specified

CISS

II: Implemented and specified III: Implemented, but not specified

slide-55
SLIDE 55

A Coverage Tool : gcov

 Standard Gnu tool gcov

O l t t t b t b li d ll f

  • logi

 Only statement coverage, but may be applied manually for

multiple condition coverage

tekno

 Compile your program under test with a special option  Run a number of test cases

tionst

 A listing indicates how often each statement was executed

and percentage of statements executed

  • rmat

and percentage of statements executed

Info

CISS

slide-56
SLIDE 56

A Coverage Tool : BullseyeCoverage

 Supports decision/condition

  • logi

 Compile your program under test with a special

  • ption

tekno

  • ption

 Run a number of test cases

tionst

 A listing indicates the coverage

  • rmat

Info

CISS

slide-57
SLIDE 57

END