Top Banner
Fall, 2006 SW Eng Standalone Progs, Univ of Colorado Boulder 1 Wk 11 Glass Box Testing, Flow Graphs, Test Coverage SW Engineering of Standalone Programs
23

Fall, 2006SW Eng Standalone Progs, Univ of Colorado Boulder 1 Wk 11 Glass Box Testing, Flow Graphs, Test Coverage SW Engineering of Standalone Programs.

Dec 21, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Fall, 2006SW Eng Standalone Progs, Univ of Colorado Boulder 1 Wk 11 Glass Box Testing, Flow Graphs, Test Coverage SW Engineering of Standalone Programs.

Fall, 2006 SW Eng Standalone Progs, Univ of Colorado Boulder

1

Wk 11 Glass Box Testing, Flow Graphs, Test Coverage

SW Engineering of Standalone Programs

Page 2: Fall, 2006SW Eng Standalone Progs, Univ of Colorado Boulder 1 Wk 11 Glass Box Testing, Flow Graphs, Test Coverage SW Engineering of Standalone Programs.

Fall, 2006 SW Eng Standalone Progs, Univ of Colorado Boulder

2

Basis set for statement coverage testing

• Draw the flow graph• Count the bounded regions including the “outside

region”– N is the number of linearly independent paths through the

program control structure

– A linearly independent path includes one node of the control flow graph not contained in any other

– Create a basis set of linearly independent paths

• Prepare test cases to force execution of each path in the basis set.

• Execution of these test cases yields ______ coverage

Page 3: Fall, 2006SW Eng Standalone Progs, Univ of Colorado Boulder 1 Wk 11 Glass Box Testing, Flow Graphs, Test Coverage SW Engineering of Standalone Programs.

Fall, 2006 SW Eng Standalone Progs, Univ of Colorado Boulder

3

Flow Graph:McCabe’s is25

Page 4: Fall, 2006SW Eng Standalone Progs, Univ of Colorado Boulder 1 Wk 11 Glass Box Testing, Flow Graphs, Test Coverage SW Engineering of Standalone Programs.

Fall, 2006 SW Eng Standalone Progs, Univ of Colorado Boulder

4

Flow Graph Revelations

Page 5: Fall, 2006SW Eng Standalone Progs, Univ of Colorado Boulder 1 Wk 11 Glass Box Testing, Flow Graphs, Test Coverage SW Engineering of Standalone Programs.

Fall, 2006 SW Eng Standalone Progs, Univ of Colorado Boulder

5

Complexity impact

Page 6: Fall, 2006SW Eng Standalone Progs, Univ of Colorado Boulder 1 Wk 11 Glass Box Testing, Flow Graphs, Test Coverage SW Engineering of Standalone Programs.

Fall, 2006 SW Eng Standalone Progs, Univ of Colorado Boulder

6

Uses of Test Coverage Measurement

• Measure test suite completeness• Identify risk areas

– Combine execution counts with complexity– Understand complex code segments that are

frequently executed– Understand criticality

• Assist in creating new test cases • Assist in manual detection of faults• Prioritize test cases for regression tests

Page 7: Fall, 2006SW Eng Standalone Progs, Univ of Colorado Boulder 1 Wk 11 Glass Box Testing, Flow Graphs, Test Coverage SW Engineering of Standalone Programs.

Fall, 2006 SW Eng Standalone Progs, Univ of Colorado Boulder

7

Some More Test Coverage terms

Page 8: Fall, 2006SW Eng Standalone Progs, Univ of Colorado Boulder 1 Wk 11 Glass Box Testing, Flow Graphs, Test Coverage SW Engineering of Standalone Programs.

Fall, 2006 SW Eng Standalone Progs, Univ of Colorado Boulder

8

Test Coverage MeasuresCompleteness of Test Suite

Page 9: Fall, 2006SW Eng Standalone Progs, Univ of Colorado Boulder 1 Wk 11 Glass Box Testing, Flow Graphs, Test Coverage SW Engineering of Standalone Programs.

Fall, 2006 SW Eng Standalone Progs, Univ of Colorado Boulder

9

Test Coverage MeasurementMinimize and select regression tests 377 Total Tests

Blocks Decisions P-uses All-uses

75% 65% 38% 44%

160 Total Tests

Blocks Decisions P-uses All-uses

75% 65% 38% 44% 18 Total Tests

Blocks Decisions P-uses All-uses

62% 52% 30% 37%

42% of the original tests provide identical coverage

5% of original tests provide 85% of original coverage

Page 10: Fall, 2006SW Eng Standalone Progs, Univ of Colorado Boulder 1 Wk 11 Glass Box Testing, Flow Graphs, Test Coverage SW Engineering of Standalone Programs.

Fall, 2006 SW Eng Standalone Progs, Univ of Colorado Boulder

10

Unit Test Coverage vsSystem Test Errors

Page 11: Fall, 2006SW Eng Standalone Progs, Univ of Colorado Boulder 1 Wk 11 Glass Box Testing, Flow Graphs, Test Coverage SW Engineering of Standalone Programs.

Fall, 2006 SW Eng Standalone Progs, Univ of Colorado Boulder

11

System Test Observed & Expected Failures

Page 12: Fall, 2006SW Eng Standalone Progs, Univ of Colorado Boulder 1 Wk 11 Glass Box Testing, Flow Graphs, Test Coverage SW Engineering of Standalone Programs.

Fall, 2006 SW Eng Standalone Progs, Univ of Colorado Boulder

12

System Test Failure Rate over Active Hrs

Page 13: Fall, 2006SW Eng Standalone Progs, Univ of Colorado Boulder 1 Wk 11 Glass Box Testing, Flow Graphs, Test Coverage SW Engineering of Standalone Programs.

Fall, 2006 SW Eng Standalone Progs, Univ of Colorado Boulder

13

System Test Case Completion Graph

Page 14: Fall, 2006SW Eng Standalone Progs, Univ of Colorado Boulder 1 Wk 11 Glass Box Testing, Flow Graphs, Test Coverage SW Engineering of Standalone Programs.

Fall, 2006 SW Eng Standalone Progs, Univ of Colorado Boulder

14

HW 7 start of codegetop(s, lim) /*get next operator or operand */

char all;

int lim;

{

int i, c;

while ((c = getch ( ) ) == ‘ ‘|| c == ‘\t’ || c == ‘\n’)

;

if (c ! = ‘.’ && (c<‘0’ || c>’9’))

return (c);

s[0] = c;

for (i=1; (c=getchar()) >= ‘0’ && c <=‘9’; i++)

if (i < lim)

s[i] = c;

if ...

Page 15: Fall, 2006SW Eng Standalone Progs, Univ of Colorado Boulder 1 Wk 11 Glass Box Testing, Flow Graphs, Test Coverage SW Engineering of Standalone Programs.

Fall, 2006 SW Eng Standalone Progs, Univ of Colorado Boulder

15

Inspections

Page 16: Fall, 2006SW Eng Standalone Progs, Univ of Colorado Boulder 1 Wk 11 Glass Box Testing, Flow Graphs, Test Coverage SW Engineering of Standalone Programs.

Fall, 2006 SW Eng Standalone Progs, Univ of Colorado Boulder

16

What are inspections?

• Means of verifying work products

• Manual examination technique

• One piece at a time

• Small group of peers – at least 4

Page 17: Fall, 2006SW Eng Standalone Progs, Univ of Colorado Boulder 1 Wk 11 Glass Box Testing, Flow Graphs, Test Coverage SW Engineering of Standalone Programs.

Fall, 2006 SW Eng Standalone Progs, Univ of Colorado Boulder

17

Purpose

• Verification of a work product against– established criteria– product specifications

Page 18: Fall, 2006SW Eng Standalone Progs, Univ of Colorado Boulder 1 Wk 11 Glass Box Testing, Flow Graphs, Test Coverage SW Engineering of Standalone Programs.

Fall, 2006 SW Eng Standalone Progs, Univ of Colorado Boulder

18

How performed?

• Planning

• Overview

• Preparation

• Meeting

• Re-work

• Follow up

Page 19: Fall, 2006SW Eng Standalone Progs, Univ of Colorado Boulder 1 Wk 11 Glass Box Testing, Flow Graphs, Test Coverage SW Engineering of Standalone Programs.

Fall, 2006 SW Eng Standalone Progs, Univ of Colorado Boulder

19

Roles of participants

• Author

• Moderator

• Reader

• Recorder

• Inspector

Page 20: Fall, 2006SW Eng Standalone Progs, Univ of Colorado Boulder 1 Wk 11 Glass Box Testing, Flow Graphs, Test Coverage SW Engineering of Standalone Programs.

Fall, 2006 SW Eng Standalone Progs, Univ of Colorado Boulder

20

The meeting

• Each participant reports preparation time• Reader paraphrases

– Pace should be effective

– Not too slow, not too fast

• Inspectors look, listen, and think simultaneously• Author and inspectors speak up if they disagree with

reader’s paraphrase – need to decide which is correct. If Reader, Recorder notes location & brief description of issue

• Moderator can adjust pace and “atmosphere”

Page 21: Fall, 2006SW Eng Standalone Progs, Univ of Colorado Boulder 1 Wk 11 Glass Box Testing, Flow Graphs, Test Coverage SW Engineering of Standalone Programs.

Fall, 2006 SW Eng Standalone Progs, Univ of Colorado Boulder

21

End of meeting

• Recorder’s list goes to author

• After rework, at a minimum, author reviews changes with one inspector.

• Better – inspect the changed item

Page 22: Fall, 2006SW Eng Standalone Progs, Univ of Colorado Boulder 1 Wk 11 Glass Box Testing, Flow Graphs, Test Coverage SW Engineering of Standalone Programs.

Fall, 2006 SW Eng Standalone Progs, Univ of Colorado Boulder

22

Benefits

• Errors found at faster rate

• Errors found early are cheaper to fix

• Cross-training

• Learn good and bad techniques by seeing them, e.g. coding techniques

Page 23: Fall, 2006SW Eng Standalone Progs, Univ of Colorado Boulder 1 Wk 11 Glass Box Testing, Flow Graphs, Test Coverage SW Engineering of Standalone Programs.

Fall, 2006 SW Eng Standalone Progs, Univ of Colorado Boulder

23

A Word about Extreme Programming

• My personal view of extreme programming is that Beck & Cunningham managed to incorporate many effective software engineering tasks into short iterations with high feedback.

• One example: pair programming is ...