Test design techniques

34
Copyright GlobalLogic 2009 1 Connect. Collaborate. Innovate. ISTQB Test design Techniques Akshi Chawla 20 th June 2011 Internal

description

 

Transcript of Test design techniques

Page 1: Test design techniques

© Copyright GlobalLogic 2009 1

Connect. Collaborate. Innovate.

ISTQBTest design Techniques

Akshi Chawla20th June 2011

Internal

Page 2: Test design techniques

© Copyright GlobalLogic 2009 2

Connect. Collaborate. Innovate.

Switch off your Mobile phoneOr

Put the Mobile phone on silent mode

Page 3: Test design techniques

© Copyright GlobalLogic 2009 3

Connect. Collaborate. Innovate.Agenda

Test design Techniques Static Testing Black Box Testing White Box testing Experience Based Testing Choosing a Testing Technique Q & A

Page 4: Test design techniques

© Copyright GlobalLogic 2009 4

Connect. Collaborate. Innovate.Test Design Techniques

Static Dynamic

Structural based

Informal ReviewInformal Review

Technical ReviewTechnical Review

WalkthroughWalkthrough

Static AnalysisStatic Analysis

InspectionInspection

Experienced Based

Data FlowData Flow

Control FlowControl Flow

Multiple ConditionMultiple Condition

ConditionCondition

ExploratoryExploratory

Error GuessingError Guessing

DecisionDecision

StatementStatement

State TransitionState Transition

Decision tableDecision table

BVABVA

EQP

Specification basedSpecification based

Use CaseUse Case

Page 5: Test design techniques

© Copyright GlobalLogic 2009 5

Connect. Collaborate. Innovate.Static Testing

Non Execution Technique Used to Review Documents Review Process

• Informal Review• Formal Review• Walkthrough• Technical Review• Inspection

Page 6: Test design techniques

© Copyright GlobalLogic 2009 6

Connect. Collaborate. Innovate.

Roles and Responsibilities1. Moderator2. Author3. Scribe4. Reviewers5. Manager

Phases of Formal Review1. Planning2. Kick Off3. Preparation4. Review Meetings5. Rework6. Follow up

Static Testing

Page 7: Test design techniques

© Copyright GlobalLogic 2009 7

Connect. Collaborate. Innovate.Static Analysis: Cyclomatic Complexity

Developed by Thomas J. McCabe Provide a quantitative measure of logical complexity of

program Cyclomatic complexity is computed using the control flow

graph of the program

Page 8: Test design techniques

© Copyright GlobalLogic 2009 8

Connect. Collaborate. Innovate.Control flow graph (CFG)

It is the way control flows through the program Three kinds of nodes:

Statement nodes: single-entry-single-exitsequences of statements

Predicate (decision) nodes: conditions forbranching

Auxiliary nodes: (optional) for easierunderstanding (e.g. “merge points” for IF)

Edges: possible flow of control

Page 9: Test design techniques

© Copyright GlobalLogic 2009 9

Connect. Collaborate. Innovate.How to Draw CFG

int f1(int x,int y){ 1. while (x != y){2. if (x>y) then 3. x=x-y;4. else y=y-x;5. }6. return x; }

Page 10: Test design techniques

© Copyright GlobalLogic 2009 10

Connect. Collaborate. Innovate.Cyclomatic complexity Definition

Cyclomatic Complexity V(G) for a graph (G) • V(G) = E-N+2

E = EdgesN=Nodes

• V(G)= P+1P= Predicate node.

• V(G) = Total number of bounded areas + 1Any region enclosed by a nodes and edge sequence.

Page 11: Test design techniques

© Copyright GlobalLogic 2009 11

Connect. Collaborate. Innovate.Example

The Flow Graph has 3 regionsV(G) = 2 predicate nodes +1= 3V(G) = 7edges- 6 nodes +2 = 3V(G) = 2 bounded area +1 = 3

11

22

33 44

55

66

Page 12: Test design techniques

© Copyright GlobalLogic 2009 13

Connect. Collaborate. Innovate.Derivation of Test Cases

Number of independent paths: 3• 1, 6 test case (x=1, y=1)• 1, 2, 3, 5, 1, 6 test case(x=1, y=2)• 1, 2, 4, 5, 1, 6 test case(x=2, y=1)

Page 13: Test design techniques

© Copyright GlobalLogic 2009 15

Connect. Collaborate. Innovate.Black box testing

Focuses on Functional and Non Functional requirement

requirements

outputs

events

inputs

Page 14: Test design techniques

© Copyright GlobalLogic 2009 16

Connect. Collaborate. Innovate.Black Box Testing Types

Equivalence class partitioning Boundary value analysis Decision table testing State Transition

Page 15: Test design techniques

© Copyright GlobalLogic 2009 17

Connect. Collaborate. Innovate.Black Box - Equivalence Class Partitioning

Input values to a program are partitioned into equivalence classes. Why we do Partitioning?

Page 16: Test design techniques

© Copyright GlobalLogic 2009 18

Connect. Collaborate. Innovate.Example

A program reads an input value in the range of 1 and 5000:• computes the square root of the input number

SQRTSQRT

There are three equivalence classes: • the set of negative integers, • set of integers in the range of 1 and 5000, • integers larger than 5000.

Page 17: Test design techniques

© Copyright GlobalLogic 2009 19

Connect. Collaborate. Innovate.Example (cont.)

The test suite must include:• representatives from each of the three equivalence classes:• a possible test suite can be:

{-5,500,6000}.

11 50005000

Page 18: Test design techniques

© Copyright GlobalLogic 2009 20

Connect. Collaborate. Innovate.Black Box - Boundary Value Analysis

Some typical programming errors occur: • at boundaries of equivalence classes

Programmers often fail to see:• special processing required at the boundaries of equivalence classes.

Compute square root of an integer in the range of 1 and 5000:• test cases : {0,1,5000,5001}.

11 50005000

Page 19: Test design techniques

© Copyright GlobalLogic 2009 21

Connect. Collaborate. Innovate.Black Box - Decision Table

A decision table is a good way to deal with combinations of things (e.g. inputs).

Known as ‘Cause-Effect' table. Testing all combinations may be impractical if not impossible How to Use Decision Table

• Identify the conditions• Identify combination of true or false. Rules = 2n (where n is number of conditions )

• Identify correct outcome for each combination• Write Test Cases based for each rule

No ISTQB Exam fee is reimbursed to the employee until he attends the training course. After attending the training, reimburse 50% for Band0 employee or 80% for Band 1 employee

Page 20: Test design techniques

© Copyright GlobalLogic 2009 22

Connect. Collaborate. Innovate.Black Box - State Transition

It focuses on how state transition from one stage to next depending on events

In this technique state of system is first recognized and then test cases are written to test the transition from one state to another

Page 21: Test design techniques

© Copyright GlobalLogic 2009 23

Connect. Collaborate. Innovate.Black Box - State Transition

A website shopping basket start out as empty. As purchases are selected they are added to shopping basket. Items can also be removed from shopping basket. When the customer decides to check out , a summary of items in the basket and total cost are shown , for customer to say whether this is Ok or not. If the content and prices are Ok, then you leave summary display and go to payment system . Otherwise you go back to shopping ( so you can remove items if you want)

Page 22: Test design techniques

© Copyright GlobalLogic 2009 24

Connect. Collaborate. Innovate.Black Box – N-Switch Testing

0-switch coverage • Coverage of all individual transitions

l-switch coverage • Coverage of transition pairs

2-switch coverage • Coverage of transition triples is, etc.

Page 23: Test design techniques

© Copyright GlobalLogic 2009 25

Connect. Collaborate. Innovate.White Box Testing

Focuses on Internal Knowledge• Exercise all independent paths• exercise all logical decisions• execute all loops

Page 24: Test design techniques

© Copyright GlobalLogic 2009 26

Connect. Collaborate. Innovate.White Box Testing Types

Statement coverage Branch coverage Path coverage Condition coverage

Page 25: Test design techniques

© Copyright GlobalLogic 2009 27

Connect. Collaborate. Innovate.White Box - Statement Coverage

Methodology: • Every statement is executed at least once.

The principal idea: • unless a statement is executed, we have no way of knowing if an error

exists in that statement

Number of Statement Exercised Statement coverage = --------------------------------------------- x 100%

Total number of statements

Page 26: Test design techniques

© Copyright GlobalLogic 2009 28

Connect. Collaborate. Innovate.Example

1 READ A 2 READ B 3 C =A + 2*B 4 IF C> 50 THEN 5 PRINT large C 6 ENDIF

11

22

33

44

55

66

Page 27: Test design techniques

© Copyright GlobalLogic 2009 29

Connect. Collaborate. Innovate.White Box - Branch Coverage

Test cases are designed such that:• different branch conditions is given true and false values in turn.

Branch testing guarantees statement coverage

Page 28: Test design techniques

© Copyright GlobalLogic 2009 30

Connect. Collaborate. Innovate.Example

Suppose that we write and execute two test cases Case 1: 1-2-exit Case 2: 1-2-3-4-5-7-8-2-3-4-5-7-8-2-exit

11

22

33

44

55 66

77

88

Page 29: Test design techniques

© Copyright GlobalLogic 2009 31

Connect. Collaborate. Innovate.White Box -Condition Coverage

Test cases are designed such that:• each component of a composite conditional expression given both true

and false values. Example

• Consider the conditional expression ((c1and c2) or c3):• Each of c1, c2, and c3 are exercised at least once i.e. given true and

false values.

Number of Condition outcome exercised Condition coverage = ---------------------------------------------------------- x 100%

Total number of Condition outcome

Page 30: Test design techniques

© Copyright GlobalLogic 2009 32

Connect. Collaborate. Innovate.Branch testing Vs Condition testing

Condition testing• stronger testing than branch testing:

Branch testing • stronger than statement coverage testing.

Page 31: Test design techniques

© Copyright GlobalLogic 2009 34

Connect. Collaborate. Innovate.Experienced Based

Error Guessing• The success of error guessing is very much dependent on the skill of

the tester Exploratory Testing

• Is a hands-on approach in which testers are involved in minimum planning and maximum test execution.

Page 32: Test design techniques

© Copyright GlobalLogic 2009 35

Connect. Collaborate. Innovate.Choosing a Testing Technique

The internal factors • Tester Knowledge /Experience• Likely Defects• Test Objective• Documentation• Life Cycle Model

External Factor• Risk• Customer /contractual Requirement• Time and budget

Page 33: Test design techniques

© Copyright GlobalLogic 2009 36

Connect. Collaborate. Innovate.

Any Questions

Page 34: Test design techniques

© Copyright GlobalLogic 2009 38

Connect. Collaborate. Innovate.

“Thank You” for your learning contribution!

Please submit Online Feedback to help L&D make continuous improvement……participation credit will be given only on

feedback submission.

For any queries Dial @ Learning:Noida: 4444, Nagpur:333, Pune:5222, Banglore:111

E mail: [email protected]

Check new L&D Reward & Recognition Policy @ Confluence under Global Training

Check new L&D Reward & Recognition Policy @ Confluence under Global Training