21
Software Architecture-based Regression Testing Henry Muccini Software Engineering and Architecture Group Università degli Studi dell'Aquila I-67100 L'Aquila, Italy [email protected] Marcio Dias Department of Computer Science and e-Science Research Institute, University of Durham, UK Debra J. Richardson Donald Bren School of Information and Computer Sciences, University of California Irvine, USA

Software Architecture-based Regression Testing

Embed Size (px)

Citation preview

Page 1: Software Architecture-based Regression Testing

Software Architecture-basedRegression Testing

Henry MucciniSoftware Engineering and Architecture Group

Università degli Studi dell'AquilaI-67100 L'Aquila, [email protected]

Marcio DiasDepartment of Computer Science and

e-Science Research Institute, University of Durham, UK

Debra J. RichardsonDonald Bren School of Information

and Computer Sciences, University of California Irvine, USA

Page 2: Software Architecture-based Regression Testing

2SEA Group

© 2005 by H. Muccini, WADS 2005 SEA Group

My main research areas: Analysis

» SEA Group

- Software Engineering and Architecture Group

» Software Architecture Analysis:

- Model-Checking SAs (the CHARMY framework)

- SA-based Testing

- SA-based Regression Testing (the SARTE project)

- Model-checking driven Testing (the ModTest approach)

» Product Line:

- Modeling Product Line Architecture

- Testing and Model Checking of Product Line

Page 3: Software Architecture-based Regression Testing

3SEA Group

© 2005 by H. Muccini, WADS 2005 SEA Group

Our Experience on SA-based analysis

Requirements

SoftwareArchitecture

M.C.[NOK]

refine SA OK [test case selection]

drive

identifyModel

Checking

SA conformance to requirements through MC

SA model functionalproperties

SoftwareArchitecture

SystemImplementation

TestExec

[NOK]Fault removal

Map SATCinto real

Test Cases

TestProcedures

Testing

Extract SA-levelTest cases

Implementation conformance to SA through Testing

SATC

provide confidence on the implementation fulfillment to its

architectural specSA-based Testing

Charmy Project

validate the SA model conformance

with respect to selected functional properties

[www.di.univaq.it/charmy]

Page 4: Software Architecture-based Regression Testing

4SEA Group

© 2005 by H. Muccini, WADS 2005 SEA Group

ModTest: Model-Checking driven Testing

Requirements

SoftwareArchitecture

M.C.[NOK]

refine SA OK [test case selection]

drive

identifyModel

Checking

SA conformance to requirements through MC

SA model functionalproperties

SystemImplementation

TestExec

[NOK]Fault removal

Testing

Implementation conformance to SA through Testing

Test spec

TestProcedures

RequirementsSpecification

ArchitecturalSpecification

CharmyAnalysis

OK

NOK Criticalsub-systemsidentification

SA Revision

TeStor

Test CaseImplementation

Test CaseExecution

System Release

OK

NOK

SystemImplementation

ImplementationRevision

a1

a2

a3

a4

a5 a7

a6

a8

Page 5: Software Architecture-based Regression Testing

5SEA Group

© 2005 by H. Muccini, WADS 2005 SEA Group

Our Recent experience in SA-based Analysis

» Industrial Experience

- PSTDA Italy [ICSE00,ICSE01]

- Telcordia

- Marconi [FME 03]

- Siemens [ITM 04]

» Academic Experience

- [FASE 04][IEEE TSE04]

- [CBSE 05][COMPSAC05]

Page 6: Software Architecture-based Regression Testing

6SEA Group

© 2005 by H. Muccini, WADS 2005 SEA Group

Considerations

» What happens if the (architectural) model changes?

- Usually, we need to remake analysis from scratch

Software Architecture SA1(version 1)

Component A Component C

Component B

Software Architecture SA2(version 2)

Component AComponent C'

Component B

Component Y

Page 7: Software Architecture-based Regression Testing

7SEA Group

© 2005 by H. Muccini, WADS 2005 SEA Group

How changes affect ModTest

Requirements

SoftwareArchitecture

M.C.[NOK]

refine SA OK [test case selection]

drive

identifyModel

Checking

SA conformance to requirements through MC

SA model functionalproperties

SystemImplementation

TestExec

[NOK]Fault removal

Testing

Implementation conformance to SA through Testing

Test spec

TestProcedures

Test Caseselection

SA spec

Test implementation

Test execution

Page 8: Software Architecture-based Regression Testing

8SEA Group

© 2005 by H. Muccini, WADS 2005 SEA Group

SA-based Regression Testing [WADS05] [COMPSAC05]

Code1(version 1)

Code2(version 2)

Software Architecture SA1(version 1)

Component A Component C

Component B

Software Architecture SA2(version 2)

Component AComponent C'

Component B

Component Y

Code

Software Architecture SA1(version 1)

Component A Component C

Component B

Code1(version 1)

Test Reuse

Test Reuse

Test Reuse

SA evolution

Code evolution

Page 9: Software Architecture-based Regression Testing

9SEA Group

© 2005 by H. Muccini, WADS 2005 SEA Group

Traditional Regression Testing

» Test modified software to provide a certain confidence that no new errors are introduced into previously tested code.

» Two key phases:

i) testing the program P with respect to a specified test suite T, and

ii) when a new version P' is released, regression testing of the modified version P' versus a test suite T'

» Selective RT:

- Goal: selecting T' as a “relevant” subset of T

> t1 in T is included in T ' if there is the potential that it could produce different results on P' than it did on P

Page 10: Software Architecture-based Regression Testing

10SEA Group

© 2005 by H. Muccini, WADS 2005 SEA Group

First phase: SA-based Code Testing» The code conformance to the SA has been already tested

Component

Component

Component

Connector

Code “P”Software Architecture “S”

Run TC over P andEvaluate Results

Refine SA-level testsinto Code-level tests

Steps 0 - 2

Identify relevantSA-level Test Cases

Step 3 Step 4

XClient

ClientA ClientB

ClientC

Class--------------------------

Page 11: Software Architecture-based Regression Testing

11SEA Group

© 2005 by H. Muccini, WADS 2005 SEA Group

SArTe – Goal 1 (code evolution)

Code1(version 1)

Code2(version 2)

Software Architecture SA1(version 1)

Component A Component C

Component B

Software Architecture SA1(version 1)

Component A Component C

Component B

Code1(version 1)

Test Reuse

» Test Conformance of a Modified Implementation P' to the initial SA

- Context:

> P correctly implements the SA S

> P' modifies P: some objects are modified, and/or some new objects are introduced.

- Goal: Test the conformance of P' with respect to S,

> while reusing previous test information for selective regression testing, thereby reducing the test cases that must be retested.

- To handle Architectural Drift

Page 12: Software Architecture-based Regression Testing

12SEA Group

© 2005 by H. Muccini, WADS 2005 SEA Group

SArTe – Goal 2 (SA evolution)

Code2(version 2)

Software Architecture SA1(version 1)

Component A Component C

Component B

Software Architecture SA2(version 2)

Component AComponent C'

Component B

Component Y

Code

Test Reuse

Test Reuse

» Test Conformance of an Evolved Software Architecture

- Context:

> P correctly implements the SA S

> S’ modifies S, adding or removing components

> A modified implementation P' may have been also developed.

- Goal: Test the conformance of P’ with respect to S',

> while reusing previous test information for selective RT, thereby reducing the test cases that must be retested.

Page 13: Software Architecture-based Regression Testing

13SEA Group

© 2005 by H. Muccini, WADS 2005 SEA Group

Goal 1: P changes

Step 0SA-spec for S

Testing Criterion

Map ATCs into Code-levelTest Cases

as a way to select T for P

Extract SA-levelTest Cases (ATCs)

Run T over Pand Evaluate Results

Step 1

Step 2

Step 3

Step 4

Build the GPgraph for P

Build the GP’graph for P’

Compare GP with GP’

Create a Test History

Select T' for P'

SA-basedRegression Testing

- Goal 1 -

SA-based Code Testing

Step B

Step C

Step D

Step A

Page 14: Software Architecture-based Regression Testing

14SEA Group

© 2005 by H. Muccini, WADS 2005 SEA Group

Considerations

» Differences with respect to traditional code-based selective RT techniques:

- code-level test cases are always selected starting from a well formalized architectural specification.

- the oracle in SA-based RT is the software architecture specification itself.

» Advantages:

- as in traditional RT, we reduce the size of the test suite for P', eliminating all those tests which do not need to be reapplied to P', and

- when conformance faults are detected, we can gather information on how to adjust the initial architecture.

Page 15: Software Architecture-based Regression Testing

15SEA Group

© 2005 by H. Muccini, WADS 2005 SEA Group

Goal 2: SA changes

Step 0

SA-spec for S

Testing Criterion

Map ATCs into Code-levelTest Cases

as a way to select T for P

Extract SA-levelTest Cases (ATCs)

Run T over Pand Evaluate Results

Step 1

Step 2

Step 3

Step 4

SA-based Code Testing

SA-spec for S’’

Compare S and S’’

Select ATCs’’ from S that needto be retested in S’’

Map ATCs’’ into Code-level TestCases as a way to select T’’ for P’’

Run T’’ over P’’ and Evaluate Results

SA-basedRegression Testing

- Goal 2 -Step a

Step c

Step d

Step e

Step f

Testing CriterionStep b

Page 16: Software Architecture-based Regression Testing

16SEA Group

© 2005 by H. Muccini, WADS 2005 SEA Group

Goal 2 Idea» Compare the two architectural specifications to identify

changed/unchanged portions of the SA.

- Both structural and behavioral changes are taken into account

> We compare the topology changes (if the SA structure changed)

> We compare the behavioral changes (if the SA behavior changed)

- and, in a fashion similar to traditional code-based RT,

> ATC needs to be re-run in S'‘, if it traverses a path modified when moving from S to S''

Page 17: Software Architecture-based Regression Testing

17SEA Group

© 2005 by H. Muccini, WADS 2005 SEA Group

Experiment 1: the Elevator SA

BuildingPanel

ElevatorPanel1

ElevatorADT1

ElevatorPanel1

ElevatorADT1

Scheduler

ElevatorPanel2

ElevatorADT2

BuildingPanel

Elevator SystemVersion 1

Elevator SystemVersion 2

Page 18: Software Architecture-based Regression Testing

18SEA Group

© 2005 by H. Muccini, WADS 2005 SEA Group

Experiment 2: the Cargo Router System

Graphics Binding (GB)

CargoRouter(CR)

PortArtist (PA)

VehicleArtist (VA)

NextShipment (NS)

Cargo Router, Version 1

WarehouseArtist (WA)

Port(P)

Vehicle(V)

Warehouse(W)

CargoRouter2(CR2)

PortArtist2 (PA2)

VehicleArtist2 (VA2)

Translator (T)

WarehouseArtist2 (WA2)

Cargo Router, Version 2

Clock(C)

PlannerArtist(PlA)

Planner (P)Bus1

Bus2

Bus2A Bus2B

Bus3ABus3

Bus4

Bus3C

a) b)

Note: In Version2, the connection (*)is replaced with the connections (**)

(*)(**)

(**)

Page 19: Software Architecture-based Regression Testing

19SEA Group

© 2005 by H. Muccini, WADS 2005 SEA Group

Future Work

» To reconstruct the actual architecture when the first goal determines that the code no longer conforms to the initial SA

» Regression Testing of Component-based Software Architectures

» Regression-based Analysis of ModTest

» Apply/refine this approach into real systems (SiemensC.N.X., Terma GmbH)

Page 20: Software Architecture-based Regression Testing

20SEA Group

© 2005 by H. Muccini, WADS 2005 SEA Group

Contact Information» Henry Muccini

- Dipartimento di Informatica, Universita' dell'Aquila, L'Aquila, Italy

- [email protected]

» Marcio Dias

- Department of Computer Science and e-Science Research Institute, University of Durham, UK

- [email protected]

» Debra J. Richardson

- Donald Bren School of Information and Computer Sciences, University of California Irvine, USA

- [email protected]

Page 21: Software Architecture-based Regression Testing

21SEA Group

© 2005 by H. Muccini, WADS 2005 SEA Group

SA diff

ATC1 in T ATC2 in T ATC1 in T’

S1

e1

S0

e1

e1e10

in(x)

S3e5

e0

e4in(y)S2S4

S6

e6e9

S7

S5

in(a)

e8e7

out(z)

in(z)

out(c)

in(b)

e6

e4

S1

e1

S0

e1

e1e10

in(x)

S3e5

e0

e4in(y)S2S4

S6

e6e9

S7

S5

in(a)

e8e7

out(z)

in(z)

out(c)

in(b)

e6

e4

S1

e1

S0

e1

e1e10

in(x)

S3e5

e0

e4in(y)S2S4

S6

e6e9

S7

S5

in(a)

e8e7

out(z)

in(z)out(w)

out(c)

in(b)S5'

e6

e4

S1

e1

S0

e1

e1e10

in(x)

S3

e0

e4in(y)S2S4

S6

e6e9

S7

S5

in(a)

e8e7

out(z)

in(z)out(w)

out(c)

in(b)S5'

e6

e4