1 / 14

Graph Coverage (1)

Graph Coverage (1). Reading Assignment. P. Ammann and J. Offutt “Introduction to Software Testing” Section 2.1. Outline. Covering Graphs Definition of a Graph Paths in Graph. Covering Graphs. Graphs are the most commonly used structure for testing Graphs can come from many sources

shaun
Download Presentation

Graph Coverage (1)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Graph Coverage (1)

  2. Reading Assignment • P. Ammann and J. Offutt “Introduction to Software Testing” • Section 2.1

  3. Outline • Covering Graphs • Definition of a Graph • Paths in Graph

  4. Covering Graphs • Graphs are the most commonly used structure for testing • Graphs can come from many sources • Control flow graphs • Design structure • FSMs and statecharts • Use cases Tests usually are intended to ‘cover’ the graph in some way.

  5. Definition of a Graph • A set N of nodes, N is not empty • A set N0 of initial nodes, N0 is not empty • A set Nf of final nodes, Nf is not empty • A set E of edges, each edge from one node to another • ( ni , nj ), ni is predecessor, nj is successor • Initial nodes appear in edges with no predecessor • Final nodes are denoted with heavy borders

  6. Three Example Graphs 0 1 2 3 0 1 2 0 Not a valid graph 3 4 5 6 1 2 7 8 9 3 N0 = { 0 } Nf = { 3 } N0 = { 0, 1, 2 } Nf = { 7, 8, 9 } N0 = { } Nf = { 3 } Sometimes graphs are restricted to those having one initial node and one final node. (how?)

  7. Paths in Graphs Path : A sequence of nodes – [n1, n2, …, nM] Each pair of nodes is an edge Length : The number of edges A single node is a path of length 0 Subpath : A subsequence of nodes in p is a subpath of p Reach (n) : Subgraph that can be reached from n

  8. 0 1 2 3 4 5 6 7 8 9 Paths in Graphs Paths [ 0, 3, 7 ] [ 1, 4, 8, 5, 1 ] [ 2, 6, 9 ] Reach (0) = { 0, 3, 4, 7, 8, 5, 1, 9 } Reach ({0, 2}) = G Reach([2,6]) = {2, 6, 9}

  9. Test Paths and SESEs Test Path : A path that starts at an initial node and ends at a final node Test paths represent execution of test cases Some test paths can be executed by many tests Some test paths cannot be executed by any tests

  10. 0 3 1 4 2 5 6 Test Paths and SESEs • SESE graphs : All test paths start at a single node and end at another node • Single-entry, single-exit • N0 and Nf have exactly one node Double-diamond graph Four test paths [ 0, 1, 3, 4, 6 ] [ 0, 1, 3, 5, 6 ] [ 0, 2, 3, 4, 6 ] [ 0, 2, 3, 5, 6 ]

  11. Visiting and Touring Visit : A test path pvisits node n if n is in p A test path pvisits edge e if e is in p Tour : A test path ptours subpath q if q is a subpath of p Path [ 0, 1, 3, 4, 6 ] Visits nodes 0, 1, 3, 4, 6 Visits edges (0, 1), (1, 3), (3, 4), (4, 6) Tours subpaths (0, 1, 3), (1, 3, 4), (3, 4, 6), (0, 1, 3, 4), (1, 3, 4, 6)

  12. Tests and Test Paths path (t) : The test path executed by test t path (T) : The set of test paths executed by the set of tests T Each test executes one and only one test path A location in a graph (node or edge) can be reached from another location if there is a sequence of edges from the first location to the second Syntactic reach : A subpath exists in the graph Semantic reach : A test exists that can execute that subpath

  13. Tests and Test Paths test 1 many-to-one Test Path test 2 test 3 Deterministic software – a test always executes the same test path many-to-many Test Path 1 test 1 test 2 Test Path 2 test 3 Test Path 3 Non-deterministic software – a test can execute different test paths

  14. Key Points • Graphs are the most commonly used structure for testing • Graphs are used in Testing • Developing a model of the software as a graph • Requiring test cases to visit or tour specific sets of nodes, edges or sub-paths.

More Related