1 software testing & quality assurance lecture 8 created by: paulo alencar modified by: frank xu

16
1 Software Testing & Quality Assurance Lecture 8 Created by: Paulo Alencar Modified by: Frank Xu

Upload: homer-lyons

Post on 01-Jan-2016

218 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: 1 Software Testing & Quality Assurance Lecture 8 Created by: Paulo Alencar Modified by: Frank Xu

1

Software Testing & Quality Assurance

Lecture 8

Created by: Paulo AlencarModified by: Frank Xu

Page 2: 1 Software Testing & Quality Assurance Lecture 8 Created by: Paulo Alencar Modified by: Frank Xu

2

OverviewFunctional Testing

Boundary Value Testing (BVT)Equivalence Class TestingDecision Table Based testingRetrospective on Functional Testing

Page 3: 1 Software Testing & Quality Assurance Lecture 8 Created by: Paulo Alencar Modified by: Frank Xu

3

General

• We have seen three main types of functional testing, BVT, ECT, and DTT.

• The common thread among these techniques is that all view a program as a mathematical function that maps its inputs to its outputs.

• In this lecture we look at questions related to testing effort, testing efficiency, and testing effectiveness.

Page 4: 1 Software Testing & Quality Assurance Lecture 8 Created by: Paulo Alencar Modified by: Frank Xu

4

Boundary Value Functional Test Cases

Case # a b c Expected Output

1 100 100 1 Isosceles

2 100 100 2 Isosceles

3 100 100 100 Equilateral

4 100 100 199 Isosceles

5 100 100 200 Not a Trianle

6 100 1 100 Isosceles

7 100 2 100 Isosceles

8 100 100 100 Equilateral

9 100 199 100 Isosceles

10 100 200 100 Not a Triangle

11 1 100 100 Isosceles

12 2 100 100 Isosceles

13 100 100 100 Equilateral

14 199 100 100 Isosceles

15 200 100 100 Not a Triangle

Page 5: 1 Software Testing & Quality Assurance Lecture 8 Created by: Paulo Alencar Modified by: Frank Xu

5

Equivalence Class Functional Test Cases

Case # a b c Output

1 5 5 5 Equilateral

2 5 5 3 Isosceles

3 5 3 5 Isosceles

4 3 5 5 Isosceles

5 3 4 5 Scalene

6 8 3 4 Not a triangle

7 7 3 4 Not a triangle

8 3 8 4 Not a triangle

9 3 7 4 Not a triangle

10 3 4 8 Not a triangle

11 3 4 7 Not a triangle

Page 6: 1 Software Testing & Quality Assurance Lecture 8 Created by: Paulo Alencar Modified by: Frank Xu

6

Decision Table Functional Test Cases

Case ID a b c Expected Output

DT1 4 1 2 Not a Triangle

DT2 1 4 2 Not a Triangle

DT3 1 2 4 Not a Triangle

DT4 5 5 5 Equilateral

DT5 ? ? ? Impossible

DT6 ? ? ? Impossible

DT7 2 2 3 Isosceles

DT8 ? ? ? Impossible

DT9 2 3 2 Isosceles

DT10 3 2 2 Isosceles

DT11 3 4 5 Scalene

Page 7: 1 Software Testing & Quality Assurance Lecture 8 Created by: Paulo Alencar Modified by: Frank Xu

7

Testing Effort (1)

boundaryvalue

equivalenceclass

decisiontable

Sophistication

high

low

Number of Test Cases

Page 8: 1 Software Testing & Quality Assurance Lecture 8 Created by: Paulo Alencar Modified by: Frank Xu

8

Testing Effort (2)

boundaryvalue

equivalenceclass

decisiontable

Sophistication

high

low

Effort to Identify Test Cases

Page 9: 1 Software Testing & Quality Assurance Lecture 8 Created by: Paulo Alencar Modified by: Frank Xu

9

Testing Effort (3)

• The domain based techniques have no recognition of data or logical dependencies; they are mechanical on generating test cases and therefore are easy to automate.

• The equivalence class techniques take into account data dependencies and the program logic however, more thought and care is required to define the equivalence relation, partition the domain, and identify the test cases.

• The decision table technique is the most sophisticated, because it requires that we consider both data and logical dependencies.

• These techniques result into a tradeoff between test identification effort and test execution effort

Page 10: 1 Software Testing & Quality Assurance Lecture 8 Created by: Paulo Alencar Modified by: Frank Xu

10

Test Case Trend Line

Test cases per method - all problems

0

50

100

150

200

250

300

350

400

rob. w.c w.c. rob. bva bva st. eq. trad eq. wk. eq. d.t.

Triangle

NextDate

Commission

Page 11: 1 Software Testing & Quality Assurance Lecture 8 Created by: Paulo Alencar Modified by: Frank Xu

11

Testing Efficiency (1)

• The data above, reveal the fundamental limitation of functional testing: the twin possibilities of

– gaps of untested functionality– redundant tests

• For example:– The decision table technique for the NextDate program generated 22 test cases

(fairly complete)– The worst case boundary analysis generated 125 cases. These are fairly redundant

(check January 1 for five different years, only a few February cases but none on February 28, and February 29, and no major testing for leap years).

– The strong equivalence class test cases generated 36 test cases 11 of which are impossible.

• The bottom line is that there are gaps and redundancy in functional test cases, and these are reduced by using more sophisticated techniques (i.e. Decision Tables).

Page 12: 1 Software Testing & Quality Assurance Lecture 8 Created by: Paulo Alencar Modified by: Frank Xu

12

Testing Efficiency (2)• The question is how can we quantify what we mean by the term testing

efficiency.

• The intuitive notion of an efficient testing technique is that it produces a set of test cases that are “just right” that is, with no gaps and no redundancy.

• We can even develop various ratios of useful test cases (i.e. not redundant, and with no gaps) with respect to the total number of test cases generated by method A and method B.

• One way to identify redundancy by annotating test cases with a brief purpose statement. Test cases with the same purpose provide a sense of redundancy measure.

• Detecting gaps is harder and this can be done only by comparing two different methods, even though there are no guarantees for complete detection of gaps.

• Overall, the structural methods (we will see later in the course), support interesting and useful metrics and these can provide a better quantification of testing efficiency.

Page 13: 1 Software Testing & Quality Assurance Lecture 8 Created by: Paulo Alencar Modified by: Frank Xu

13

Testing Effectiveness

• Essentially, how effective a method or a set of test cases is for finding faults present in a program. However this is problematic for two reasons:– First it presumes we know all faults in a program– The second reason deals with the impossible task to prove that a program

is free of faults (it is equivalent to solving the halting problem)

• The best we can do is to work backward from fault types, that is given a fault type we can chose testing methods that are likely to reveal faults of that type. Extensions include:– Use knowledge related to the most likely kinds of faults to occur– Track kinds and frequencies of faults in the software applications we

develop

• Structured techniques, can be more easily assessed with respect to their effectiveness, by considering how well cover a specific criterion.

Page 14: 1 Software Testing & Quality Assurance Lecture 8 Created by: Paulo Alencar Modified by: Frank Xu

14

Guidelines

• Kinds of faults may reveal some pointers as to which testing method to use.

• If we do not know the kinds of faults that are likely to occur in the program then the attributes most helpful in choosing functional testing methods are:

– Whether the variables represent physical or logical quantities– Whether or not there are dependencies among variables– Whether single or multiple faults are assumed– Whether exception handling is prominent

Page 15: 1 Software Testing & Quality Assurance Lecture 8 Created by: Paulo Alencar Modified by: Frank Xu

15

Guidelines for Functional Testing Technique Selection (1)

• The following selection guidelines can be considered:

1. If the variables refer to physical quantities and/or are independent domain testing and equivalence testing can be considered.

2. If the variables are dependent, decision table testing can be considered

3. If the single-fault assumption is plausible to assume, boundary value analysis and robustness testing can be considered

4. If the multiple-fault assumption is plausible to assume, worst case testing, robust worst case testing, and decision table testing can be considered

5. If the program contains significant exception handling, robustness testing and decision table testing can be considered

6. If the variables refer to logical quantities, equivalence class testing and decision table testing can be considered

Page 16: 1 Software Testing & Quality Assurance Lecture 8 Created by: Paulo Alencar Modified by: Frank Xu

16

Guidelines for Functional Testing Technique Selection (2)

C1: variables Physical (P) Logical (L) P P P P P L L L L L

C2: Independent Variables? Y Y Y Y N Y Y Y Y N

C3: Single fault assumption? Y Y N N - Y Y N N -

C4: Exception handling? Y N Y N - Y N Y N -

A1: Boundary value analysis X

A2: Robustness testing X

A3: Worst case testing X

A4: Robust worst case testing X

A5: Traditional equivalence testing X X X X

A6: Weak equivalence testing X X X X

A7: Strong equivalence testing X X X X X X

A8: Decision table X X