Data Flow Testing - Strategies
-
Upload
sunit-prasad -
Category
Documents
-
view
597 -
download
3
description
Transcript of Data Flow Testing - Strategies
![Page 1: Data Flow Testing - Strategies](https://reader035.fdocuments.in/reader035/viewer/2022073116/5524dbfe4a7959c8488b48fb/html5/thumbnails/1.jpg)
Data Flow Testing
THE STRATEGIES Page 163 of the Boris Beizer text
![Page 2: Data Flow Testing - Strategies](https://reader035.fdocuments.in/reader035/viewer/2022073116/5524dbfe4a7959c8488b48fb/html5/thumbnails/2.jpg)
Basics of strategies…• Data flow testing strategies are structural strategies.• Data flow strategies require data-flow link weights
(d,k,u,c,p).• They are based on selecting test path segments (sub-
paths) that satisfy some characteristic of data flows for all data objects.
• A strategy X is stronger than strategy Y if all test cases produced under Y are included in those produced under X.
• Conversely for weaker strategies.
![Page 3: Data Flow Testing - Strategies](https://reader035.fdocuments.in/reader035/viewer/2022073116/5524dbfe4a7959c8488b48fb/html5/thumbnails/3.jpg)
Overview of the strategies considered:
• The structural test strategies that we will discuss in the further slides are based on the program’s control flow graph.
• The differences in these strategies are – – the predicate uses and/or computational uses of variables
included in the test set– All computational uses versus at least one computational
use– Both computational and predicate versus either one or
the other
![Page 4: Data Flow Testing - Strategies](https://reader035.fdocuments.in/reader035/viewer/2022073116/5524dbfe4a7959c8488b48fb/html5/thumbnails/4.jpg)
All – du paths (ADUP):• This is the strongest data-flow testing strategy.• A du-path from node i to k is a path segment such
that, if the last link has a computational use of X, then the path is simple & definition clear.
• ADUP is a data-flow testing strategy that requires every definition of every variable from every du path to use every variable of that definition.
• ADUP becomes more complicated when a variable is redefined in many places.
• This strategy considers one test at a time. • ADUP requires the greatest number of paths.
![Page 5: Data Flow Testing - Strategies](https://reader035.fdocuments.in/reader035/viewer/2022073116/5524dbfe4a7959c8488b48fb/html5/thumbnails/5.jpg)
All – du paths (ADUP cont…): Example:
From the figure, we see that variables A and B are defined on link (1,2). It is evident that any path taken for the graph will traverse through (1,2) . Hence the criterion for variables A & B as per ADUP is satisfied. But we have a redefinition at link (3,4). Variable C will not satisfy ADUP if only the path (1,3) is taken, thus violating the ADUP definition.
ADUP becomes complicated when a variable is redefined in many places.
1 2 3 4Begin End
A, B C
![Page 6: Data Flow Testing - Strategies](https://reader035.fdocuments.in/reader035/viewer/2022073116/5524dbfe4a7959c8488b48fb/html5/thumbnails/6.jpg)
All – Uses strategy (AU):• Here, we step down from all paths to branch
coverage.• AU is a strategy that requires every definition from at
least one path segment to use every variable that can be reached by that definition.
If a variable X has a predicate use as shown above, the sub-paths (2,3,4) and (2,4) would be included in some tests. In AU strategy, we don’t have to use both in the same path, meaning (4,5) can be reached by either (2,3,4) or (2,4).
1 2 3 4Begin End C 5
X
![Page 7: Data Flow Testing - Strategies](https://reader035.fdocuments.in/reader035/viewer/2022073116/5524dbfe4a7959c8488b48fb/html5/thumbnails/7.jpg)
All – du paths (ADUP cont…): Example:
From the figure, we see that variables A and B are defined on link (1,2). It is evident that any path taken for the graph will traverse through (1,2) . Hence the criterion for variables A & B as per ADUP is satisfied. But we have a redefinition at link (3,4). Variable C will not satisfy ADUP if only the path (1,3) is taken, thus violating the ADUP definition.
ADUP becomes complicated when a variable is redefined in many places.
1 2 3 4Begin End
A, B C
![Page 8: Data Flow Testing - Strategies](https://reader035.fdocuments.in/reader035/viewer/2022073116/5524dbfe4a7959c8488b48fb/html5/thumbnails/8.jpg)
All–p–Uses/Some–c–Uses strategies (APU+C):• If a variable has a predicate use, then, there is no
need to select a computational use. • The (APU+C) is a strategy requires that – for every
variable and its definition, include at least one definition-free path from the definition to every predicate use. If there are definitions of the variable that are not covered by predicate use, then add computational-use test cases as required, to cover every definition.
![Page 9: Data Flow Testing - Strategies](https://reader035.fdocuments.in/reader035/viewer/2022073116/5524dbfe4a7959c8488b48fb/html5/thumbnails/9.jpg)
All–p–Uses/Some–c–Uses strategies (APU+C cont…): d P cd cd cd P P
• In the (APU + C) strategy, every definition of every variable has a path to every P-use of that definition.
If there is no P-use of the definition, then a c-use is considered.
• Links (1,2), (3,4), (4,5), (5,6) must be included in test cases because they contain definitions for variable Z. The links (2,3),(6,7),(8,9) must also be included in test cases because they contain predicate uses of Z, which c-use does not cover.
1 2 4 5Begin 3 7 86 9 End Z
Flow graph annotated for variable Z
![Page 10: Data Flow Testing - Strategies](https://reader035.fdocuments.in/reader035/viewer/2022073116/5524dbfe4a7959c8488b48fb/html5/thumbnails/10.jpg)
All–c–Uses/Some–p–Uses strategies (ACU-P):• In this testing strategy, we first need to ensure that every
definition has a computational use of that definition and if any definition is not covered, predicate use cases are added to ensure(make sure) that every definition is included in some test case.
• Definition:(ACU + P) is a testing strategy which requires that every definition of every variable includes at least one path from that definition to every computational use.
![Page 11: Data Flow Testing - Strategies](https://reader035.fdocuments.in/reader035/viewer/2022073116/5524dbfe4a7959c8488b48fb/html5/thumbnails/11.jpg)
All–c–Uses/Some–p–Uses strategies (ACU-P cont…):
d c c p c p
c
• As seen above, ACU coverage is achieved for Y by the path (1,2,3,4,7,8,9,10). But several definitions of predicate uses are not covered – path (4,5,6,7).
• In this testing strategy, every definition of every variable has a path to every c-use of that definition. If there is no c-use of that definition, the p-use of the definition is considered. Hence, the (ACU+P) coverage of the path for Y should be (1,2,3,4,7,8,9,10).
1 2 4 5Begin 3
End Z
Flow graph annotated for variable Y
10 9 7 68
Y
![Page 12: Data Flow Testing - Strategies](https://reader035.fdocuments.in/reader035/viewer/2022073116/5524dbfe4a7959c8488b48fb/html5/thumbnails/12.jpg)
All – Definitions strategy (AD):• The AD strategy is weaker than both (ACU+P) and (APU+C)
strategies.• Definition: AD is a testing strategy that requires every definition
of every variable to cover at least one use of that variable. The use can be a computational use(c) or a predicate use(p).
• The path (1,2,3,4,5,6,7,8,9,10) satisfies the AD strategy for variable Y. For the variable Z, any entry or exist path satisfies the AD criterion. Therefore, we expect that the AD strategy is weaker than both the (ACU+P) and (APU+C) strategies.
• Every definition has a path to at least one use of that definition.
**Refer the earlier slide for fig.
![Page 13: Data Flow Testing - Strategies](https://reader035.fdocuments.in/reader035/viewer/2022073116/5524dbfe4a7959c8488b48fb/html5/thumbnails/13.jpg)
All–Predicate–Uses Strategy:• In this testing strategy, every definition of every
variable has a path to every P-use of that definition.• If there is no P-use in the definition, then it is dropped
from the contention(argument).• Definition: APU is a testing strategy derived from the
(APU+C) strategy. But here, we do not include a c-use for the variable if there are no p-uses for the variable following each definition.APU is therefore weaker than (APU+C).
![Page 14: Data Flow Testing - Strategies](https://reader035.fdocuments.in/reader035/viewer/2022073116/5524dbfe4a7959c8488b48fb/html5/thumbnails/14.jpg)
All–Computational Uses Strategies:
• Also referred to as the ACU strategy.• Definition:
ACU is a testing strategy derived from the (ACU+P) strategy. But here, we do not include a p-use for the variable if there are no c-uses for the variable following each definition.
• It is therefore evident(obvious) that ACU is weaker than (ACU+P).
![Page 15: Data Flow Testing - Strategies](https://reader035.fdocuments.in/reader035/viewer/2022073116/5524dbfe4a7959c8488b48fb/html5/thumbnails/15.jpg)
Ordering the strategies:
All Paths
All DU Paths
All-C Uses
All-P/Some-CAll-C/Some-P
All Uses
All-P UsesAll Definitions
Branch
Statement
This shows the relative strength of data flow & control flow testing strategies.
Test cases are based on the Relative strength of testing strategies.
(ACU+P) & (APU+C) are in parallel & hence
comparable
The strength of the testing strategies reduces along the Direction of the arrow. For example, All-Uses is weaker than All DU paths.
Branch & Statement are control flow test strategies
![Page 16: Data Flow Testing - Strategies](https://reader035.fdocuments.in/reader035/viewer/2022073116/5524dbfe4a7959c8488b48fb/html5/thumbnails/16.jpg)
Done!!! Do feel free to get back incase you have any questions
Note: This did appear in earlier papers. So please don’t skip!!