Decision Testing and Decision Coverage. ISTQB Whitebox techniques with TestCompetence

21
Decision Testing and Decision Coverage with Prepare yourself for the ISTQB exam

description

Whitebox techniques - Decision Testing and Decision Coverage - prepare yourself for the ISTQB exam with TestCompetence.

Transcript of Decision Testing and Decision Coverage. ISTQB Whitebox techniques with TestCompetence

Page 1: Decision Testing and Decision Coverage. ISTQB Whitebox techniques with TestCompetence

Decision Testing and Decision Coverage with

Prepare yourself for the ISTQB exam

Page 2: Decision Testing and Decision Coverage. ISTQB Whitebox techniques with TestCompetence

Dictionary

branch: A basic block that can be selected for execution based on a program construct in which one of two or more alternative program paths is available, e.g. case, jump, go to, if-then- else. branch coverage: The percentage of branches that have been exercised by a test suite. 100% branch coverage implies both 100% decision coverage and 100% statement coverage. branch testing: A white box test design technique in which test cases are designed to execute branches.

From „Standard glossary of terms used in Software Testing”

Copyright © 2013

Page 3: Decision Testing and Decision Coverage. ISTQB Whitebox techniques with TestCompetence

Dictionary

decision: A program point at which the control flow has two or more alternative routes. A node with two or more links to separate branches. decision coverage: The percentage of decision outcomes that have been exercised by a test suite. 100% decision coverage implies both 100% branch coverage and 100% statement coverage. decision testing: A white box test design technique in which test cases are designed to execute decision outcomes. decision outcome: The result of a decision (which therefore determines the branches to be taken).

From „Standard glossary of terms used in Software Testing”

Copyright © 2013

Page 4: Decision Testing and Decision Coverage. ISTQB Whitebox techniques with TestCompetence

What is…?

Decision coverage, related to branch testing, is the assessment of the percentage of decision outcomes (e.g. the True and False options of an IF statement) that have been exercised by a test case suite. Decision testing derives test cases to execute specific decision outcomes, normally to increase decision coverage.

Decision testing is a form of control flow testing as it generates a specific flow of control through the decision points. Decision coverage is stronger than statement coverage: 100% decision coverage guarantees 100% statement coverage, but not vice versa.

From „Certified Tester Foundation Level Syllabus (version 2011)”

Copyright © 2013

Page 5: Decision Testing and Decision Coverage. ISTQB Whitebox techniques with TestCompetence

Rules!

100% branch coverage implies 100% decision coverage. Branch testing = arc testing = algorithm testing

From „Certified Tester Foundation Level Syllabus (version 2011)”

Copyright © 2013

Page 6: Decision Testing and Decision Coverage. ISTQB Whitebox techniques with TestCompetence

sep = az * wn;

csc = dvz + isc + d;

Copyright © 2013

Examples with sequential code

There are no decisions to take.

Page 7: Decision Testing and Decision Coverage. ISTQB Whitebox techniques with TestCompetence

IF (vz)

{

fuf = azh - e;

}

ic = pcg + icn / n;

Copyright © 2013

Examples with IF

In order to cover all decisions and branches,

you need 2 test cases.

Page 8: Decision Testing and Decision Coverage. ISTQB Whitebox techniques with TestCompetence

IF (lfn)

{

j = ag + vy - f;

}

ELSE

{

l = ar * hkh;

}

vgd = i * qla / p;

Copyright © 2013

Examples with IF ELSE

In order to cover all decisions and branches,

you need 2 test cases.

Page 9: Decision Testing and Decision Coverage. ISTQB Whitebox techniques with TestCompetence

SWITCH (i)

{

CASE 0:

krg = z - kz;

break;

CASE 1:

tob = zrc * cxd;

break;

}

rl = gs / dl * s;

Copyright © 2013

Examples with SWITCH

In order to cover all decisions and branches,

you need 2 test cases.

Page 10: Decision Testing and Decision Coverage. ISTQB Whitebox techniques with TestCompetence

uyn = -9;

WHILE (bo || uyn < -3)

{

qx = q - ba / i;

uyn++;

}

moa = 4;

WHILE (ei || moa > -3)

{

h = udi * cj;

moa--;

}

Copyright © 2013

Examples with WHILE

In order to cover all decisions and branches,

you need 1 test case.

Page 11: Decision Testing and Decision Coverage. ISTQB Whitebox techniques with TestCompetence

FOR (a = 5; a > -5; a--)

{

b = c + 1;

}

Copyright © 2013

Examples with FOR

In order to cover all decisions and branches,

you need 1 test case.

Page 12: Decision Testing and Decision Coverage. ISTQB Whitebox techniques with TestCompetence

IF (u)

{

IF (s)

{

l = el * n * iq;

}

ELSE

{

fz = ga / ca + vd;

}

}

ELSE

{

IF (upd)

{

w = tvo / x + y;

}

ELSE

{

grm = neq + ads;

}

}

e = lcu + b;

Copyright © 2013

More examples

In order to cover all decisions and branches,

you need 4 test cases.

Page 13: Decision Testing and Decision Coverage. ISTQB Whitebox techniques with TestCompetence

h = -4;

WHILE (ww || h < 6)

{

zx = 1;

WHILE (iya || zx > -9)

{

hm = am * x;

zx--;

}

h++;

}

ye = 7;

WHILE (iob || ye > 2)

{

boi = nk - u + ijy;

ye--;

}

Copyright © 2013

More examples

In order to cover all decisions and branches,

you need 1 test cases.

Page 14: Decision Testing and Decision Coverage. ISTQB Whitebox techniques with TestCompetence

vc = 8;

WHILE (xa || vc > -2)

{

FOR (i = 0; i < 2; i++)

{

FOR (qgn = 1; qgn > -2; qgn--)

{

p = u * ufi;

}

}

vc--;

}

FOR (ij = -2; ij > -12; ij--)

{

pqr = n + fdq / jx;

}

Copyright © 2012

More examples

In order to cover all decisions and branches,

you need 1 test cases.

Page 15: Decision Testing and Decision Coverage. ISTQB Whitebox techniques with TestCompetence

More examples with…

TestCompetence allows you to generate sample pseudocode to pracitse whitebox

techniques including statement coverage…

Copyright © 2013

Page 16: Decision Testing and Decision Coverage. ISTQB Whitebox techniques with TestCompetence

More examples with…

TestCompetence allows you to generate sample pseudocode to pracitse whitebox

techniques including decision coverage…

Copyright © 2013

Choose the level of nested

statements.

Choose the maximum number of instructions per level.

Choose the type of

coverage from:

statement, decision, codition, multiple

condition, and modified

condition.

Choose the type of

statement.

GENERATE your exercise.

Page 17: Decision Testing and Decision Coverage. ISTQB Whitebox techniques with TestCompetence

More examples with…

You get pseudocode and sample answers just like during a regular ISTQB exam.

Choose the right answer.

Copyright © 2013

Choose an answer.

Pseudocode

Page 18: Decision Testing and Decision Coverage. ISTQB Whitebox techniques with TestCompetence

More examples with…

You get pseudocode and sample answers just like during a regular ISTQB exam.

Choose the right answer.

Copyright © 2013

Pseudocode

Your answer

Right answer

Page 19: Decision Testing and Decision Coverage. ISTQB Whitebox techniques with TestCompetence

How to get it…

Visit TestCompetence.com and get one for only…

Copyright © 2013

EURO / USD

Unlimited number of exercises during 24 hours!