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

Statement Testing and Statement Coverage. ISTQB whitebox techniques with TestCompetence

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: Statement Testing and Statement Coverage. ISTQB whitebox techniques with TestCompetence

Statement Testing and Statement Coverage with

Prepare yourself for the ISTQB exam

Page 2: Statement Testing and Statement Coverage. ISTQB whitebox techniques with TestCompetence

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

Page 3: Statement Testing and Statement Coverage. ISTQB whitebox techniques with TestCompetence

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

Page 4: Statement Testing and Statement Coverage. ISTQB whitebox techniques with TestCompetence

Rules

100% branch coverage implies both 100% decision coverage and 100% statement coverage.

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

Copyright © 2013

Page 5: Statement Testing and Statement Coverage. ISTQB whitebox techniques with TestCompetence

a = b + c

d = e * e

Copyright © 2013

Examples with sequential code

In order to cover all statements, you need

1 test case.

Page 6: Statement Testing and Statement Coverage. ISTQB whitebox techniques with TestCompetence

IF (wa)

{

ev = ghd - pkq / cds;

}

Copyright © 2013

Examples with IF

In order to cover all statements, you need

1 test case.

Page 7: Statement Testing and Statement Coverage. ISTQB whitebox techniques with TestCompetence

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.

Page 8: Statement Testing and Statement Coverage. ISTQB whitebox techniques with TestCompetence

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.

Page 9: Statement Testing and Statement Coverage. ISTQB whitebox techniques with TestCompetence

a = 1;

WHILE (a < 5)

{

b = c;

a++;

}

Copyright © 2013

Examples with WHILE

In order to cover all statements, you need

1 test case.

Page 10: Statement Testing and Statement Coverage. ISTQB whitebox techniques with TestCompetence

DO{

a = a + 1

} WHILE (a <= 0)

Copyright © 2013

Examples with DO WHILE

In order to cover all statements, you need

1 test case.

Page 11: Statement Testing and Statement 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 statements, you need

1 test case.

Page 12: Statement Testing and Statement Coverage. ISTQB whitebox techniques with TestCompetence

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.

Page 13: Statement Testing and Statement Coverage. ISTQB whitebox techniques with TestCompetence

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.

Page 14: Statement Testing and Statement Coverage. ISTQB whitebox techniques with TestCompetence

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.

Page 15: Statement Testing and Statement 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: Statement Testing and Statement 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

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: Statement Testing and Statement 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

Choose an answer.

Page 18: Statement Testing and Statement 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: Statement Testing and Statement 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!