Upload
radoslaw-smilgin
View
8.996
Download
1
Embed Size (px)
DESCRIPTION
Citation preview
Statement Testing and Statement Coverage with
Prepare yourself for the ISTQB exam
Dictionary
statement: an entity in a programming language, which is typically the smallest indivisible unit of execution. statement testing: a white box test design technique in which test cases are designed to execute statements. statement coverage: the percentage of executable statements that have been exercised by a test suite. executable statement: a statement which, when compiled, is translated into object code, and which will be executed procedurally when the program is running and may perform an action on data. code coverage: an analysis method that determines which parts of the software have been executed (covered) by the test suite and which parts have not been executed, e.g. statement coverage, decision coverage or condition coverage.
From „Standard glossary of terms used in Software Testing”
Copyright © 2013
What is…?
Statement coverage is the assessment of the percentage of executable statements that have been exercised by a test case suite. Statement testing derives test cases to execute specific statements, normally to increase statement coverage.
From „Certified Tester Foundation Level Syllabus (version 2011)”
Copyright © 2013
Rules
100% branch coverage implies both 100% decision coverage and 100% statement coverage.
From „Certified Tester Foundation Level Syllabus (version 2011)”
Copyright © 2013
a = b + c
d = e * e
Copyright © 2013
Examples with sequential code
In order to cover all statements, you need
1 test case.
IF (wa)
{
ev = ghd - pkq / cds;
}
Copyright © 2013
Examples with IF
In order to cover all statements, you need
1 test case.
IF (weu)
{
i = o - f;
}
ELSE
{
u = gkt * k;
}
Copyright © 2013
Examples with IF ELSE
In order to cover all statements, you need
2 test cases.
SWITCH (yc)
{
CASE 0:
epl = o / c;
break;
CASE 1:
p = wt * bd;
break;
CASE 2:
fbt = xg + ana - cs;
break;
DEFAULT:
qxn = q / ti;
break;
}
Copyright © 2013
Examples with SWITCH
In order to cover all statements, you need
4 test cases.
a = 1;
WHILE (a < 5)
{
b = c;
a++;
}
Copyright © 2013
Examples with WHILE
In order to cover all statements, you need
1 test case.
DO{
a = a + 1
} WHILE (a <= 0)
Copyright © 2013
Examples with DO WHILE
In order to cover all statements, you need
1 test case.
FOR (a = 5; a > -5; a--)
{
b = c + 1;
}
Copyright © 2013
Examples with FOR
In order to cover all statements, you need
1 test case.
IF (a)
{
b = c + d;
}
ELSE
{
IF (e)
{
b = c - d;
}
}
Copyright © 2013
More examples
In order to cover all statements, you need
2 test cases.
IF (a)
{
IF (f)
{
g = h - i;
}
}
ELSE
{
IF (e)
{
b = c - d;
}
}
Copyright © 2013
More examples
In order to cover all statements, you need
2 test cases.
SWITCH (a)
{
CASE 0:
IF (b)
{
c;
}
break;
CASE 1:
IF (d)
{
e;
}
ELSE
{
f;
}
break;
}
Copyright © 2012
More examples
In order to cover all statements, you need
3 test cases.
More examples with…
TestCompetence allows you to generate sample pseudocode to pracitse whitebox
techniques including statement coverage…
Copyright © 2013
More examples with…
TestCompetence allows you to generate sample pseudocode to pracitse whitebox
techniques including statement 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.
More examples with…
You get pseudocode and sample answers just like during a regular ISTQB exam.
Choose the right answer.
Copyright © 2013
Pseudocode
Choose an answer.
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
How to get it…
Visit TestCompetence.com and get one for only…
Copyright © 2013
EURO / USD
Unlimited number of exercises during 24 hours!
Check also examples for…
• Decision testing and coverage >> • Condition testing and coverage >> • Multiple condition testing and
coverage >> • Modified condition decision
combination (MC/CD) coverage >>
Copyright © 2013