• No results found

Outline of the Lecture. Software Testing. Unit & Integration Testing. Components. Lecture Notes 3 (of 4)

N/A
N/A
Protected

Academic year: 2021

Share "Outline of the Lecture. Software Testing. Unit & Integration Testing. Components. Lecture Notes 3 (of 4)"

Copied!
8
0
0

Loading.... (view fulltext now)

Full text

(1)

January, 2007 CUGS, SE, Mariam Kamkar, IDA, LiU 1

Software Testing

Lecture Notes 3 (of 4)

January, 2007 CUGS, SE, Mariam Kamkar, IDA, LiU 2

Outline of the Lecture

• Integration Testing

– Top-down

– Bottom-up

– Big-bang

– Sandwich

• System Testing

• Acceptance Testing

• Distribution of Faults in a large Industrial Software System

(ISSTA 2002)

January, 2007 CUGS, SE, Mariam Kamkar, IDA, LiU 3

Unit & Integration Testing

Objective: to ensure that code implemented

the design properly.

Design Specification

Code = System

January, 2007 CUGS, SE, Mariam Kamkar, IDA, LiU 4

Com

ponent

cod

e

Com

ponent

cod

e

Tested components

Tested components

Unit

test

Unit

test

Integration

test

Design Specification

Integrated modules

Components

Component to be tested driver

stub stub Test

cases Boundary conditions independent paths interface ...

(2)

January, 2007 CUGS, SE, Mariam Kamkar, IDA, LiU 7

Top-down

Stubs for four components

January, 2007 CUGS, SE, Mariam Kamkar, IDA, LiU 8

January, 2007 CUGS, SE, Mariam Kamkar, IDA, LiU 9 January, 2007 CUGS, SE, Mariam Kamkar, IDA, LiU 10

A

B

F

E

D

G

C

Top-down

A B F E D G C

Top-down

A B F E D G C

Test ABCDG

Test ABCDEFG

Test A

Test ABCD

(3)

January, 2007 CUGS, SE, Mariam Kamkar, IDA, LiU 13

Modified Top-down

January, 2007 CUGS, SE, Mariam Kamkar, IDA, LiU 14

Test A

Test B

Test D

G

Test C

F

E

Test

A, B, C,

Test

A, B, C, D,

E, F, G

Modified Top-down

January, 2007 CUGS, SE, Mariam Kamkar, IDA, LiU 15

Bottom-up

January, 2007 CUGS, SE, Mariam Kamkar, IDA, LiU 16

(4)

January, 2007 CUGS, SE, Mariam Kamkar, IDA, LiU 19

A

B

F

E

D

G

C

January, 2007 CUGS, SE, Mariam Kamkar, IDA, LiU 20

Bottom-up

A B F E D G C

January, 2007 CUGS, SE, Mariam Kamkar, IDA, LiU 21

Bottom-up

A B F E D G C

Tets ABCDEFG

Test BEF

Test F

Test E

Tets DG

Tets G

Test C

January, 2007 CUGS, SE, Mariam Kamkar, IDA, LiU 22

Big-bang

Test A

Test ABCDEFG

Test B

Test C

Test F

Test E

Test D

Test G

A B F E D G C

A

B

F

E

D

G

C

Sandwich

A B F E D G C

Target level B,C,D

(5)

January, 2007 CUGS, SE, Mariam Kamkar, IDA, LiU 25

Sandwich

A B F E D G C

Test A

Test ABCDEFG

Test B, E, F

Test F

Test E

Test D, G

Test G

Target level B,C,D

January, 2007 CUGS, SE, Mariam Kamkar, IDA, LiU 26

Modified Sandwich

A B F E D G C

January, 2007 CUGS, SE, Mariam Kamkar, IDA, LiU 27

Modified Sandwich

A B F E D G C

Test A

Test ABCDEFG

Test B, E, F

Test F

Test E

Test D, G

Test G

Test B

Test D

Test C

January, 2007 CUGS, SE, Mariam Kamkar, IDA, LiU 28

Yes

Yes

Early

Early

Modified

Sandwich

Yes

Yes

Early

Early

Modified

Top-Down

Early

Late

Early

Early

Integration

Yes

Yes

No

Yes

Stubs

needed

Yes

Yes

Yes

No

Driver

needed

Early

Late

Late

Early

Time to

basic

working

program

Sandwich

Big-bang

Bottom-up

Top-down

Comparison of Integration Strategies

• System Testing Steps

– Function testing / Thread testing

– Performance testing

– Acceptance testing

– Installation testing

• Test Automation

• Termination Problem

Objective

:

to ensure that the system does what

the customer wants it to do

.

Customer

Developer

Requirements definition

Requirements specification

Functional requirements

Nonfunctional requirements

System Testing

(6)

January, 2007 CUGS, SE, Mariam Kamkar, IDA, LiU 31

Unit

test

Com

ponent

cod

e

Integration

test

Tested components

Design Specification

Unit

test

Com

ponent

cod

e

Tested components

Integrated modules

January, 2007 CUGS, SE, Mariam Kamkar, IDA, LiU 32

Function

test

Performance

test

Acceptance

test

Installation

test

Int

egrat

ed m

odul

es

F

unct

ioni

n

g

syst

em

s

Verif

ied validate

d

sof

tware

System functional requirements

Other software requirements

Accept

ed

system

System

In

Use!

Customer requirements spec.

User environment

January, 2007 CUGS, SE, Mariam Kamkar, IDA, LiU 33

Function testing/Thread testing

(testing one function at a time)

functional requirements

• Threads:

– A scenario of normal usage

– A stimulus/response pair

– Behavior that results from a sequence of system-level input

– An interleaved sequence of port input and output events

– A sequence of atomic system functions (ASF)

• ASF: an atomic system function is an action that is

observable at the system level in terms of port input and

output events

January, 2007 CUGS, SE, Mariam Kamkar, IDA, LiU 34

A function test checks that the integrated system

performs its function as specified in the

requirement

• Guidelines

– use a test team independent of the designers and

programmers

– know the expected actions and output

– test both valid and invalid input

– never modify the system just to make testing easier

– have stopping criteria

Cause-and-Effect-Graph

(test case generation from req.)

• causes: inputs

• effects: outputs and transformations

• causes-and-effect graph:

– boolean graph reflecting causes and effects

relationships

– is a formal language into which a natural language

specification is translated

a

b

Identity: if

a

then

b

b

a

c

And: if (

a

and

b

) then

c

b

a

c

d

Or: if (

a

or

b

or

c

) then

d

a

b

Identity: if (not

a

) then

b

Basic cause-effect graph symbols

(7)

January, 2007 CUGS, SE, Mariam Kamkar, IDA, LiU 37

Specification

: the character in column 1 must be an “A” or a “B”. The

character in column 2 must be a digit. In this situation, the file update is

made. If the first character is incorrect, message X12 is issued. If the second

character is not a digit, message X13 is issued

.

Causes

C1: character in column 1 is “A”

C2: character in column 1 is “B”

C3: character in column 2 a digit

Effects

E1: update made

E2: message X12 is issued

E3:message X13 is issued

January, 2007 CUGS, SE, Mariam Kamkar, IDA, LiU 38

Sample cause-effect graph

2

1

11

3

E3

E1

E2

Intermediate node

January, 2007 CUGS, SE, Mariam Kamkar, IDA, LiU 39

Constraint symbols

b

a

E

b

a

O

b

a

c

I

a

b

R

E cause-constraint: at most one of

a

or

b

can be true

O cause-constraint: one, and only one,

of

a

and

b

must be true

I cause-constraint:

at least one of

a

,

b

and

c

must always be true

R cause-constraint:

for

a

to be true,

b

must be true

a

b

M

M effect-constraint:

If effect

a

to is true,

Effect

b

is forced to be false

January, 2007 CUGS, SE, Mariam Kamkar, IDA, LiU 40

Sample cause-effect graph with “exclusive” constraint

2

1

11

3

E3

E1

E2

11: Intermediate node

E

Decision table for cause-and effect graph

1

0

0

0

Effect E3

0

1

0

0

Effect E2

0

0

1

1

Effect E1

0

X

1

1

Cause 3

X

0

1

0

Cause 2

X

0

0

1

Cause 1

Test 4

Test 3

Test 2

Test 1

Performance Testing

nonfunctional requirements

• Stress tests

• Volume tests

• Configuration tests

• Compatibility tests

• Regression tests

• Security tests

• Timing tests

• Environment tests

• Quality tests

• Recovery tests

• Maintenance tests

• Documentation tests

• Human factors tests /

(8)

January, 2007 CUGS, SE, Mariam Kamkar, IDA, LiU 43

Acceptance Testing

customers, users need

• Benchmark test: a set of special test cases

• Pilot test: everyday working

– Alpha test: at the developer’s site, controlled

environment

– Beta test: at one or more customer site.

• Parallel test: new system in parallel with previous

one

January, 2007 CUGS, SE, Mariam Kamkar, IDA, LiU 44

Installation Testing

users site

Acceptance test at developers site

Æ

installation test at users site,

otherwise may not be needed!!

January, 2007 CUGS, SE, Mariam Kamkar, IDA, LiU 45

Test Automation

• Automating parts of the testing process can provide

long-term benefits to organization, such as:

– reducing the amount of time it takes to execute a suite of

tests

– reducing the tester’s involvement in executing tests

– facilitating regression testing

– allowing for the simulation of hundreds of users

– avoiding human mistakes by having tools control

repetitive and tedious tasks

• Test automation refers to two key testing activities:

– Executing the tests

– Evaluating the output

January, 2007 CUGS, SE, Mariam Kamkar, IDA, LiU 46

Automated Testing Tools

• Code Analysis tools

– Static, Dynamic

• Test execution tools

– Capture-and-Replay

– Stubs & Drivers

– Comparators

• Test case generator

Termination Problem

How decide when to stop testing

• The main problem for managers!

• Termination takes place when

• resources (time & budget) are over

• found the seeded faults

References

Related documents