Transcript
Page 1: Mt s8 wbt_test_designtechniques

DO NOT DISTRIBUTE – HIGHLY CONFIDENTIAL

Agenda:

Test Design Techniques

Page 2: Mt s8 wbt_test_designtechniques

DO NOT DISTRIBUTE – HIGHLY CONFIDENTIAL

Test Design Techniques:

What is a testing technique?

• A procedure for selecting or designing tests.

• Based on a structural or functional model of the software.

• Successful at finding faults.

• Best practice.

• A way of deriving good test cases.

• A way of objectively measuring a test effort.

Note: Testing should be rigorous, thorough and

systematic.

2 www.talentsprint.com

Page 3: Mt s8 wbt_test_designtechniques

DO NOT DISTRIBUTE – HIGHLY CONFIDENTIAL

Test Design Techniques:

Advantages of Techniques:

• Different People:

– Higher probability to find similar faults.

– Gain some independence of thought

• Effective Testing:

– Finds more faults

– Focus attention on specific types of fault

– Know you're testing the right thing

3 www.talentsprint.com

Page 4: Mt s8 wbt_test_designtechniques

DO NOT DISTRIBUTE – HIGHLY CONFIDENTIAL

Test Design Techniques:

Advantages of Techniques:

• Efficient Testing:

– Find more faults with less effort

– Avoid duplication

– Systematic techniques are measurable

Note: Using techniques makes testing much more effective.

4 www.talentsprint.com

Page 5: Mt s8 wbt_test_designtechniques

DO NOT DISTRIBUTE – HIGHLY CONFIDENTIAL

Test Design Techniques:

Advantages of Techniques:

• Efficient Testing:

– Find more faults with less effort

– Avoid duplication

– Systematic techniques are measurable

Note: Using techniques makes testing much more effective.

5 www.talentsprint.com

Page 6: Mt s8 wbt_test_designtechniques

6

Introduction to Testing Techniques

Testing

Techniques

Scripted Testing Experience

Based Testing

Static

Testing

Dynamic

Testing

Tool-Based

Testing

People-Based

Testing

Black Box

Testing

White Box

Testing

Error-Guessing

Technique

Error-Guessing

Testing

Technique

Page 7: Mt s8 wbt_test_designtechniques

7

Based on behavior /

functionality of software

Based on structure of

software

Introduction to Testing Techniques

Examination of

documentation, source code

listings, etc.

Static (Non-execution)

Behavioral (Black Box)

Structural (White Box)

Types of Systematic Techniques

Dynamic Testing

Page 8: Mt s8 wbt_test_designtechniques

DO NOT DISTRIBUTE – HIGHLY CONFIDENTIAL

Test Design Techniques:

Scripted Testing:

• People Based Testing

• Tool Based Testing

8 www.talentsprint.com

Reviews

Walkthroughs

Desk-checking

Static Analysis Inspection

etc.

Static

Page 9: Mt s8 wbt_test_designtechniques

DO NOT DISTRIBUTE – HIGHLY CONFIDENTIAL

Test Design Techniques:

When is scripted testing used?

• Repeatability:

– When the tests are detailed enough so that some one other than the

author to execute it in an identical way.

• Objectivity:

– Test creation does not depend on the extraordinary skill of the

person creating the test but is based on well understood test design

principles.

• Auditability: Traceability from requirements, design, and code to

the test cases and back again.

9 www.talentsprint.com

Page 10: Mt s8 wbt_test_designtechniques

10

IEEE 829 Test Documents?

Scripted Testing

Test Plan

Test Design

Specification

Test Log

Test

Incident

Report

Test

Execution Test Item

Transmittal

Report

Test Case

Specification

Test Procedure

Specification

Test

Summary

Report

Page 11: Mt s8 wbt_test_designtechniques

DO NOT DISTRIBUTE – HIGHLY CONFIDENTIAL

Test Design Techniques:

Dynamic Testing:

– White Box Test Design Techniques

– Black Box Test Design Techniques

11 www.talentsprint.com

Page 12: Mt s8 wbt_test_designtechniques

DO NOT DISTRIBUTE – HIGHLY CONFIDENTIAL

Test Design Techniques:

White Box Test Design Techniques:

• The main objective of white box testing is to ensure 100%

code coverage.

Code coverage:

• The percentage of code tested during white box testing is called code

coverage.

• The source code behind a unit may contain a set of statements, a set of

conditions and a set of branches. If all these are tested, then we say

100% code coverage is achieved.

12 www.talentsprint.com

Page 13: Mt s8 wbt_test_designtechniques

DO NOT DISTRIBUTE – HIGHLY CONFIDENTIAL

Test Design Techniques:

Why White Box Test Design Techniques:

• As testing everything at code level may be impossible.

• To avoid this, at the same to ensure 100% code coverage

the following techniques are introduced in white box

testing.

13 www.talentsprint.com

Page 14: Mt s8 wbt_test_designtechniques

DO NOT DISTRIBUTE – HIGHLY CONFIDENTIAL

Test Design Techniques:

White Box Test Design Techniques:

• Statement Coverage

• Branch/Condition/ Decision Coverage

• Path Coverage

• Cyclomatic Complexity

14 www.talentsprint.com

Page 15: Mt s8 wbt_test_designtechniques

DO NOT DISTRIBUTE – HIGHLY CONFIDENTIAL

Test Design Techniques:

White Box Test Design Techniques:

Statement Coverage:

• The percentage of statements tested during white box

testing is called statement coverage.

• Statement coverage=

(Number of statements tested/total number of statements) x 100

15 www.talentsprint.com

Page 16: Mt s8 wbt_test_designtechniques

DO NOT DISTRIBUTE – HIGHLY CONFIDENTIAL

Test Design Techniques:

White Box Test Design Techniques:

Branch/ Decision/ Condition Coverage:

• The percentage of branches tested during white box

testing is called branch coverage.

• Branch coverage=

(Number of branches tested/total number of branches) x 100

16 www.talentsprint.com

Page 17: Mt s8 wbt_test_designtechniques

DO NOT DISTRIBUTE – HIGHLY CONFIDENTIAL

Test Design Techniques:

White Box Test Design Techniques:

Path Coverage:

• The percentage of paths tested during white box testing is

called path coverage.

• Path coverage=

(Number of paths tested/total number of paths) x 100

17 www.talentsprint.com

Page 18: Mt s8 wbt_test_designtechniques

DO NOT DISTRIBUTE – HIGHLY CONFIDENTIAL

Test Design Techniques:

White Box Test Design Techniques:

Cyclomatic Complexity:

• Cyclomatic complexity is a source code complexity

measurement that is being correlated to a number of

coding errors.

• It is calculated by developing a Control Flow Graph of the

code that measures the number of linearly-independent

paths through a program module.

18 www.talentsprint.com

Page 19: Mt s8 wbt_test_designtechniques

DO NOT DISTRIBUTE – HIGHLY CONFIDENTIAL

Test Design Techniques:

White Box Test Design Techniques:

Cyclomatic Complexity:

Cyclomatic complexity =E - N + P

where,

E = number of edges in the flow graph.(Lines)

N = number of nodes in the flow graph.(Shapes)

P = number of nodes that have exit points

19 www.talentsprint.com

Page 20: Mt s8 wbt_test_designtechniques

DO NOT DISTRIBUTE – HIGHLY CONFIDENTIAL

Test Design Techniques:

White Box Test Design Techniques:

Cyclomatic Complexity:

• Cyclomatic Complexity C = Number of Decision Points

(i.e. the Decision Boxes in Flow diagram) + 1

20 www.talentsprint.com

Page 21: Mt s8 wbt_test_designtechniques

DO NOT DISTRIBUTE – HIGHLY CONFIDENTIAL

Test Design Techniques:

Points to Remember:

• 100% LCSAJ will ensure 100% branch coverage.

• 100% branch coverage will ensure 100% statement

coverage.

• 100% path coverage will ensure 100% statement

coverage.

• 100% path coverage will ensure 100% branch coverage.

• Best Technique: Path Coverage.

21 www.talentsprint.com

Page 22: Mt s8 wbt_test_designtechniques

DO NOT DISTRIBUTE – HIGHLY CONFIDENTIAL

Test Design Techniques:

Case Study :

• Consider a code and how many minimum number of tests are required

to cover 100% Statement & Branch & Path coverage & what is

Cyclomatic Complexity?

Read P

Read Q

IF P+Q >100 then

Print “Large”

End IF

IF P>50 then

Print “ P Bigger”

End IF

22 www.talentsprint.com

Page 23: Mt s8 wbt_test_designtechniques

DO NOT DISTRIBUTE – HIGHLY CONFIDENTIAL

Test Design Techniques:

Assignment-1

Read A

If A>0 then

If A>21 then

Print “Key”

End IF

End If

23 www.talentsprint.com

Page 24: Mt s8 wbt_test_designtechniques

DO NOT DISTRIBUTE – HIGHLY CONFIDENTIAL

Test Design Techniques:

Assignment-2

Read A

Read B

If A>0 then

if B=0 then

Print “No Values”

else

Print B

if A>21 then

Print A

End If

End IF

End If

24 www.talentsprint.com

Page 25: Mt s8 wbt_test_designtechniques

DO NOT DISTRIBUTE – HIGHLY CONFIDENTIAL

Test Design Techniques:

Assignment-3

Read A

Read B

If A<0 then

Print “A Negative”

else

Print “A Positive”

End IF

If B<0 then

Print “B Negative”

else

Print “B Positive”

End If

25 www.talentsprint.com

Page 26: Mt s8 wbt_test_designtechniques

DO NOT DISTRIBUTE – HIGHLY CONFIDENTIAL

Test Design Techniques:

Assignment-4

Read A

Read B

If A<0 then

Print “A Negative”

End IF

If B<0 then

Print “B Negative”

End If

26 www.talentsprint.com

Page 27: Mt s8 wbt_test_designtechniques

DO NOT DISTRIBUTE – HIGHLY CONFIDENTIAL

Test Design Techniques:

Assignment-5

Read A

If A<0 then

Print “A Negative”

End IF

If A>0 then

Print “A Positive”

End If

27 www.talentsprint.com

Page 28: Mt s8 wbt_test_designtechniques

DO NOT DISTRIBUTE – HIGHLY CONFIDENTIAL

Review Questions:

28 www.talentsprint.com

White Box Testing Techniques:

• The Structure-Based or White Box Testing Techniques, as described

in BS 7925-2 standards, are :

– Statement Testing

– Branch / Decision Testing

– Data Flow Testing

– Branch Condition Testing

– Branch Condition Combination Testing

– Modified Condition Decision Testing

– LCSAJ (Linear Code Sequence and Jump) Testing

Note: All these techniques can also be used as Measurement Techniques.

Page 29: Mt s8 wbt_test_designtechniques

29

Question and Answer