You are on page 1of 20

Condition Testing and Condition Coverage

with

Prepare yourself for the ISTQB exam


Dictionary
condition: A logical expression that can be evaluated as True or False, e.g. A>B.
See also test condition.

condition outcome: The evaluation of a condition to True or False.

condition testing: A white box test design technique in which test cases are
designed to execute condition outcomes.

compound condition: Two or more single conditions joined by means of a logical


operator (AND, OR or XOR), e.g. ‘A>B AND C>1000’.

condition coverage: The percentage of condition outcomes that have been


exercised by a test suite. 100% condition coverage requires each single condition in
every decision statement to be tested as True and False.

From „Standard glossary of terms used in Software Testing”

Copyright © 2013
What is…?

Condition coverage, there are stronger levels of


structural coverage beyond decision coverage, for
example, condition coverage.
From „Certified Tester Foundation Level Syllabus (version 2011)”

Copyright © 2013
Rules!

branch condition = condition


branch condition coverage = condition coverage

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

Copyright © 2013
Examples with sequential code
hiz = xs + pkl;
gff = sy - dr / nxa;

No condition to cover.

Copyright © 2013
Examples with IF
IF (iuc && fow)
{
t = jcc + iky - hhs; In order to cover all
} conditions, you need
2 test cases.

Copyright © 2013
Examples with IF ELSE
IF (r && ha)
{
f = utx + g;
} In order to cover all
ELSE conditions, you need
{ 2 test cases.
mq = nxc * bff * cb;
}

Copyright © 2013
Examples with SWITCH
SWITCH (ck)
{
CASE 0: In order to cover all
jm = c - h; conditions, you need
break; 3 test cases.
CASE 1:
si = pkb * t;
break;
CASE 2:
vh = ocd * fq;
break;
}

Copyright © 2013
Examples with WHILE

In order to cover all


au = -6; conditions, you need
WHILE (ojc && ar || au < 8) 2 test cases.
{
ys = dsk - mfg;
au++;
}

Copyright © 2013
Examples with FOR
FOR (kv = 8; kv > -2; kv--)
{
pl = gvp * ge; In order to cover all
} conditions, you need
1 test case.

Copyright © 2013
More examples
IF (e || u)
{
IF (bp || oxq || i)
{ In order to cover all
IF (gzy || f) conditions, you need
{
3 test cases.
n = yo / ocx - uf;
}
}
}
IF (mt && vdi)
{
IF (oye || cos || yxi)
{
IF (uc || nm || mlk)
{
duz = x - pae - tct;
}
}
}

Copyright © 2013
More examples
IF (zw || uzq && ppv)
{
e = vqg / obq + qrb; In order to cover all
} conditions, you need
ELSE 2 test cases.
{
IF (fl || z)
{
j = qki / on - fbj;
}
ELSE
{
ab = wy * jb;
}
}
ixr = ms + d;

Copyright © 2013
More examples
l = jcy * ykj - dp;
FOR (qyt = 1; qyt < 8; qyt++)
{
ew = 15; In order to cover all
WHILE (d || jw || ew > 2) conditions, you need
{ 2 test cases.
FOR (zw = 9; zw < 16; zw++)
{
syg = v + ha / cls;
}
ew--;
}
}
mmb = wte * il;

Copyright © 2012
More examples with…
TestCompetence allows you to generate sample pseudocode to pracitse whitebox
techniques including condition coverage…

Copyright © 2013
More examples with…
TestCompetence allows you to generate sample pseudocode to pracitse whitebox
techniques including condition coverage…

Choose the
maximum
number of
Choose the instructions
level of per level.
nested
statements. Choose the
type of
Choose the coverage
type of from:
statement. statement,
decision,
codition,
multiple
condition,
GENERATE and modified
your exercise. condition.

Copyright © 2013
More examples with…
You get pseudocode and sample answers just like during a regular ISTQB exam.
Choose the right answer.

Pseudocode

Choose
an answer.

Copyright © 2013
More examples with…
You get pseudocode and sample answers just like during a regular ISTQB exam.
Choose the right answer.

Pseudocode

Your answer

Right answer

Copyright © 2013
How to get it…
Visit TestCompetence.com and get one for only…

EURO / USD

Unlimited number of exercises during 24 hours!

Copyright © 2013
Check also examples for…
• Statement testing and coverage >>

• Decision testing and coverage >>

• Multiple condition testing and


coverage >>

• Modified condition decision


combination (MC/CD) coverage >>

Copyright © 2013

You might also like