Top Banner
Coverage Criteria for Testing of Object Interactions in Sequence Diagrams Atanas (Nasko) Rountev Scott Kagan Jason Sawin Ohio State University
21

Coverage Criteria for Testing of Object Interactions in Sequence Diagrams Atanas (Nasko) Rountev Scott Kagan Jason Sawin Ohio State University.

Jan 03, 2016

Download

Documents

Caroline Lloyd
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: Coverage Criteria for Testing of Object Interactions in Sequence Diagrams Atanas (Nasko) Rountev Scott Kagan Jason Sawin Ohio State University.

Coverage Criteria for Testing of Object Interactions in Sequence Diagrams

Atanas (Nasko) RountevScott KaganJason SawinOhio State University

Page 2: Coverage Criteria for Testing of Object Interactions in Sequence Diagrams Atanas (Nasko) Rountev Scott Kagan Jason Sawin Ohio State University.

UML Sequence Diagrams

Shows messages exchanged among objects

Contains control information relevant to message passing

a:A b:B c:C d:D

m1 m2[c1] m3

m4

[c3] m6 m2

[c2] m5

[c1] m3

m4

[c2] m5

Page 3: Coverage Criteria for Testing of Object Interactions in Sequence Diagrams Atanas (Nasko) Rountev Scott Kagan Jason Sawin Ohio State University.

Sequence Diagrams and Testing Object interaction testing Coverage criteria for sequence diagrams

all paths, all branches, etc. Most existing work utilizes the all paths

criterion

Page 4: Coverage Criteria for Testing of Object Interactions in Sequence Diagrams Atanas (Nasko) Rountev Scott Kagan Jason Sawin Ohio State University.

Sequence Diagrams and Testing Most existing work focuses on design time

diagrams Diagrams can also be reverse engineered

from code more paths due to less abstraction

Do existing sequence diagram based testing approaches generalize to reverse engineered diagrams? should the all paths criterion be considered?

Page 5: Coverage Criteria for Testing of Object Interactions in Sequence Diagrams Atanas (Nasko) Rountev Scott Kagan Jason Sawin Ohio State University.

Our Work

Investigated 4 different coverage criteria for reverse engineered sequence diagrams defined each criterion in terms of an RCFG tree developed a method for comparing criteria performed a comparison of the criteria on real

world Java code

Page 6: Coverage Criteria for Testing of Object Interactions in Sequence Diagrams Atanas (Nasko) Rountev Scott Kagan Jason Sawin Ohio State University.

RCFG Tree

Restricted Control Flow Graph (RCFG) similar to a traditional CFG for message passing only

RCFG tree represents a sequence diagram set of all start to end paths for both structures is the same

Root RCFG is top level method Edges connecting RCFGs represent method

invocations RCFG n is a child of RCFG m means method m may

invoke method n

Page 7: Coverage Criteria for Testing of Object Interactions in Sequence Diagrams Atanas (Nasko) Rountev Scott Kagan Jason Sawin Ohio State University.

m1

start

end

m2

m6

m5

end

m4

start m3

m5

end

m4

start m3

m6

start

end

m2

a:A d:Dc:Cb:B

[c1] m3

m2

m2

[c1] m3

m4

[c2] m5

m1

m4

[c2] m5

[c3] m6

m2m2

start

end

m4

Page 8: Coverage Criteria for Testing of Object Interactions in Sequence Diagrams Atanas (Nasko) Rountev Scott Kagan Jason Sawin Ohio State University.

RCFG Tree Details

Straightforward to construct when reverse-engineering sequence diagrams

Can be traversed at run time to collect coverage statistics

Page 9: Coverage Criteria for Testing of Object Interactions in Sequence Diagrams Atanas (Nasko) Rountev Scott Kagan Jason Sawin Ohio State University.

Coverage Criteria Considered All start to end paths All RCFG paths All RCFG branches All unique branches

m1

start

end

m2

m6

m5

end

m4

start m3

m5

end

m4

start m3

m6

start

end

m2

m2m2

Page 10: Coverage Criteria for Testing of Object Interactions in Sequence Diagrams Atanas (Nasko) Rountev Scott Kagan Jason Sawin Ohio State University.

Criterion Comparison Technique Each start to end path corresponds to one

test case For each criterion, calculate minimum

number of start to end paths required to achieve complete coverage indirect estimate of testing effort

Page 11: Coverage Criteria for Testing of Object Interactions in Sequence Diagrams Atanas (Nasko) Rountev Scott Kagan Jason Sawin Ohio State University.

Minimum Number of Paths

All start to end paths: 20 All RCFG paths: 5 All RCFG branches: 3 All unique

branches: 2

m1

start

end

m2

m6

m5

end

m4

start m3

m5

end

m4

start m3

m6

start

end

m2

m2m2

Page 12: Coverage Criteria for Testing of Object Interactions in Sequence Diagrams Atanas (Nasko) Rountev Scott Kagan Jason Sawin Ohio State University.

Calculating Minimum Number of Paths All start to end paths

calculate the number of paths from the start node of an RCFG to the end node of the RCFG must consider paths in children

start with the leaves, propagate up to the root All RCFG paths, all RCFG branches, all

unique branches integer linear programming

Page 13: Coverage Criteria for Testing of Object Interactions in Sequence Diagrams Atanas (Nasko) Rountev Scott Kagan Jason Sawin Ohio State University.

Valid Path Property If node n represents a method call and edge

(m, n) is part of a path p, p must include an inter-method edge (n, start) p must include an intra-method edge (n, r)

n

m

r

start

q

Page 14: Coverage Criteria for Testing of Object Interactions in Sequence Diagrams Atanas (Nasko) Rountev Scott Kagan Jason Sawin Ohio State University.

Valid Path Property

If node n represents a method call and edge (n, start) is part of a path p, p must include an intra-method edge (start, q)

n

m

r

start

q

Page 15: Coverage Criteria for Testing of Object Interactions in Sequence Diagrams Atanas (Nasko) Rountev Scott Kagan Jason Sawin Ohio State University.

RCFG Branches Property

Consider some set of paths S that satisfies the RCFG branch property every RCFG edge appears in at least one path

n

m

r

start

q

Page 16: Coverage Criteria for Testing of Object Interactions in Sequence Diagrams Atanas (Nasko) Rountev Scott Kagan Jason Sawin Ohio State University.

Integer Linear Programming Formulation ILP equations encode the valid path property

and the RCFG branches property variables are edge frequencies constraints

each frequency is at least 1 frequency sums are equal

(red, green, blue)n

m

r

start

q

Page 17: Coverage Criteria for Testing of Object Interactions in Sequence Diagrams Atanas (Nasko) Rountev Scott Kagan Jason Sawin Ohio State University.

Proof Obligation

Solution to the integer linear programming problem is a frequency count for each edge

Need to prove There exists a set of paths that meets the

coverage criterion and has the same edge frequencies

No smaller set of paths satisfies the criterion

Page 18: Coverage Criteria for Testing of Object Interactions in Sequence Diagrams Atanas (Nasko) Rountev Scott Kagan Jason Sawin Ohio State University.

Remaining Criteria

Integer linear programming formulation valid paths property a criterion specific property

All unique branches the sum of the edges frequencies for equivalent

edges is at least one All RCFG paths

each edge is covered at least as many times as its local edge frequency

Page 19: Coverage Criteria for Testing of Object Interactions in Sequence Diagrams Atanas (Nasko) Rountev Scott Kagan Jason Sawin Ohio State University.

Experimental Study

Implemented as part of the RED tool (Reverse Engineering of sequence Diagrams)

Implementation used lp_solve linear programming tool

Input code: code from the Java standard libraries 1104 RCFG trees average 36 RCFGs per tree

Page 20: Coverage Criteria for Testing of Object Interactions in Sequence Diagrams Atanas (Nasko) Rountev Scott Kagan Jason Sawin Ohio State University.

Minimum Number of Paths

0.0%

10.0%

20.0%

30.0%

40.0%

50.0%

60.0%

1-5 6-10 11-100 101-1000 > 1000

Start to End Paths RCFG Paths RCFG Branches Unique Branches

Page 21: Coverage Criteria for Testing of Object Interactions in Sequence Diagrams Atanas (Nasko) Rountev Scott Kagan Jason Sawin Ohio State University.

Future Work

Implement dynamic analyses for obtaining coverage statistics

Measure coverage achieved by real world test suites