Download presentation

Presentation is loading. Please wait.

Published byPayton Tonkinson Modified over 3 years ago

1
Random Testing Tor Stålhane Jonas G. Brustad

2
What is random testing The principle of random testing is simple and can be described as follows: 1.For each input parameter, generate a random but legal value. 2.Apply the full set of inputs to the SUT 3.Register the result and go back to step 1.

3
Chen’s observation Inputs that are close to each others in the input domain tends to go through the same path. Thus, in order to find most of the errors, we should spread the test cases as much as possible. This approach is called Adaptive Random Testing. We will look at four approaches: Partition Adaptive Random Testing Basic Random Testing – RT Basic Adaptive Random Testing – ART Mirror Adaptive Random Testing – MART

4
Block failure pattern

5
Strip failure pattern

6
Point failure pattern

7
Some notation D: input domain size n: number of test cases m: number of tests that fail F = D/m. Note that – Large F => small m => few errors detected – Small F => large m => many errors detected = 1/F – failure rate F rel = F obs *

8
Partition Adaptive Random Testing Tor Stålhane Jonas G. Brustad

9
ART by random partitioning – 1 Algorithm for a two-dimensional case 1.Start with C = {(X min, Y min ), (X max, Y max )} 2.Draw a random point in C = (X 1, Y 1 ). This will split C into four regions – R1, R2, R3 and R4. Select T = max area {R1, R2, R3, R4} See next slide.

10
ART by random partitioning – 2 (X max, Y max ) {(X min, Y min ), (X 1, Y 1 ) R1T = R2 R3R4 Select a test (X 1, Y 1 ) in T. If it is a failure, report the failure and stop. Otherwise, split T in the same way as we split C – see next slide

11
ART by random partitioning – 3 Select a test (X 2, Y 2 ) in T. If it is a failure, report the failure and stop. Otherwise, repeat the process (X max, Y max ) {(X min, Y min ), (X 1, Y 1 ) R1T R3R4 (X 2, Y 2 )

12
ART by bisection – 1 Algorithm for a two-dimensional case 1.Start with C = {(X min, Y min ), (X max, Y max )} 2.Draw a random test in C – (X 1, Y 1 ). If it fails we are finished. Otherwise split C in two equal parts – see next slide.

13
ART by bisection – 2 (X max, Y max ) {(X min, Y min ), (X 1, Y 1 ) Select a test (X 2, Y 2 ) in the untested half of C. If it is a failure, report the failure and stop. Otherwise, split C again – see next slide (X 2, Y 2 )

14
ART by bisection – 3 Select a test (X 2, Y 2 ) in T. If it is a failure report, the failure and stop. Otherwise, repeat the process for each part that we have not tested – (X 3, Y 3 ) and (X 4, Y 4 ) (X max, Y max ) {(X min, Y min ), (X 1, Y 1 ) (X 2, Y 2 ) (X 4, Y 4 ) (X 3, Y 3 )

15
The exclusion factor – 1 All types of Adaptive Random Testing (ART) can be improved by introducing the exclusion factor, usually denoted by f. This factor will force the new tests away from the tests that have already been run. The optimal factor value will vary, depending on the failure rate and on the failure pattern – block, strip or point.

16
The exclusion factor – 2

17
The exclusion factor – 3 Based on this, we have chosen f = 0.4 as the best value.

18
Comparisons

19
Basic Adaptive Random Testing Tor Stålhane Jonas G. Brustad

20
Fixed Size Candidate Set - FSCS

21
Max distance – 1 Let a and b be two n-dimensional inputs {a 1, a 2,..., a n } and {b 1, b 2,..., b n }. E.g. in a two-dimensional space we have the two parameters a ={1, 2} and b = {2, 5}. Then we have dist(a, b) = sqrt(1 + 9) = 3.16

22
Max distance – 2 Let T and C be two disjoint sets T = {t 1, t 2,...t n } is the set of executed tests C = {c 1, c 2,...c k } is the candidate set. Find the c h that satisfies: This criterion will spread the test cases evenly by finding the largest minimum distance between the next test case – selected from C – and the already executed test cases in T.

23
Max distance algorithm

24
A small example – 1 We have two data sets: T = {(1, 1), (3,4)} – already executed tests C = {(1, 2), (3, 1)} – candidate test set 3 2 1 1 2 3 t1t1 c2c2 c1c1 4 t2t2

25
A small example – 2 Using the max distance algorithm we get: j = 1 => (c 1, t 1 ) dist = 1.0, (c 1, t 2 ) dist = 2.8 j = 2 => (c 2, t 1 ) dist = 2.0, (c 2, t 2 ) dist = 3.0 min(dist) = 1.0 and the first distance larger than min(dist) is 2.0 => Next test is c 2 = (3, 1)

26
Test comparison – 1 Defect types seeded: AOR: Arithmetic Operator Replacement ROR: Relational Operator Replacement SVR: Scalar Variable Replacement CR: Constant Replacement

27
Results with RT 1

28
Results with ART (a) and FSCS (r) N

29
Test comparison – 2

30
Mirror Adaptive Random Testing Tor Stålhane Jonas G. Brustad

31
The problem with ART All versions of ART require a large amount of computations due to the distance calculations and comparisons. The MART – Mirror ART – is simpler and requires less computation.

32
The MART procedure The procedure has four steps: 1.Partition the input domain into m disjoint subdomains. One is chosen as source subdomain. The rest are mirror subdomains 2.Apply the D-ART process to generate the next test case from the source subdomain. Execute this test case and quit if we find a defect. 3.Apply the mirror function to the test case from step 2 to generate a test case for each mirror subdomain. Execute the test cases in sequential order and stop when we find a defect. 4.Repeat steps 2 and 3 until finding the first failure or until reaching the stopping condition.

33
Mirror partitioning Below we see several ways to create mirror partitions: X2Y1 => X is bisected, y is unchanged X2Y2 => both X and Y are bisected X4Y2 => X is split into four parts, Y is bisected X4Y1 => X is split into four parts, Y is unchanged

34
The D-ART process 1.Set E to be the empty set 2.Select a random test case from the input domain and execute it. If no failure, add the test case to E, otherwise stop. 3.Construct C = {c 1, c 2,…, c k }, where all c i are randomly selected and E and C are disjoint. 4.Let n = |E| and select c j so that 5.Repeat steps 3 and 4 until first defect is found

Similar presentations

OK

Simulated-Annealing-Based Solution By Gonzalo Zea s031418 Shih-Fu Liu s031003.

Simulated-Annealing-Based Solution By Gonzalo Zea s031418 Shih-Fu Liu s031003.

© 2018 SlidePlayer.com Inc.

All rights reserved.

To ensure the functioning of the site, we use **cookies**. We share information about your activities on the site with our partners and Google partners: social networks and companies engaged in advertising and web analytics. For more information, see the Privacy Policy and Google Privacy & Terms.
Your consent to our cookies if you continue to use this website.

Ads by Google

Free download ppt on crop production and management Ppt on mbti personality test Ppt on cross-sectional study example Ppt on water resources free download Ppt on indian culture and philosophy Ppt on describing words for class 1 Ppt on p&g products promotion Ppt on mpeg video compression Ppt on juvenile rheumatoid arthritis Ppt on carbon arc welding