Faults Found by Random Testing WanChi Chio Justin Molinyawe - - PowerPoint PPT Presentation

faults found by random testing
SMART_READER_LITE
LIVE PREVIEW

Faults Found by Random Testing WanChi Chio Justin Molinyawe - - PowerPoint PPT Presentation

Faults Found by Random Testing WanChi Chio Justin Molinyawe Introduction Why apply random testing to object oriented software? Cost-efficient in terms of implementation effort and execution time. Introduction (Cont.)


slide-1
SLIDE 1

Faults Found by Random Testing

WanChi Chio Justin Molinyawe

slide-2
SLIDE 2

Introduction

  • Why apply random testing to object
  • riented software?

○ Cost-efficient in terms of implementation

effort and execution time.

slide-3
SLIDE 3

Introduction (Cont.)

  • Characteristics of random testing

○ Predictability in terms of number and nature of faults. ○ Average time it takes to find a failure. ○ Distribution of detected faults.

slide-4
SLIDE 4

Introduction (Cont.)

Experiments

  • Predictability of Random Testing

○ Creating and using tests with AutoTest for 27 classes from Eiffel library.

  • Each class was tested for 90 minutes. For

each class, testing sessions were ran 30 times with different seeds.

slide-5
SLIDE 5

Unit Tests for Object- Oriented Programs

  • Purpose: to verify the run of a particular

routine: ○ test routine "test_x" for routine "x"

  • Hard-coded stubs must be used to replace

non-trivial routines which are not under test for a strict interpretation, but it does not usually happens in practice

slide-6
SLIDE 6

Unit Tests for Object-Oriented Programs (Cont.)

  • Input are created in two ways by:

○ loading previously saved objects into memory => to provide complete control

  • ver the input creation

○ calling a series of constructors to create and modify data through normal means => to yield more relevant data

slide-7
SLIDE 7

Unit Tests for Object-Oriented Programs (Cont.)

○ Oracle/expect output can be provided in

different levels of abstractions for validation through following specifications:

■ The exact expected output - good for

complex scenarios

■ Conditions that the output should fulfill

for any input

■ "No exception" as the expected output

  • easier to be re-used for other tests
slide-8
SLIDE 8

Random Tests Cases for Eiffel Library Experiment

  • Testing is completely automated with test

cases created under the following criterias:

○ Unit - routines of Eiffel classes ■ Test synthesizer makes test cases where

the goal is to test each particular routine (Test Case Synthesis Algorithm)

○ Input - Objects are created through

regular constructor and routine calls.

■ To enforce diversity, the initial objects are

modified for new test cases

slide-9
SLIDE 9

Random Tests Cases for Eiffel Library Experiment (Cont.)

○ Oracle ■ Contract-based by containing specifications in the form of routine pre and postconditions and class invariants

slide-10
SLIDE 10

Faults and failures of Random Testing

  • Usually, failures are an observed difference

between the actual and intended behavior.

  • Results relied on an approximation that

maps failures to faults based on:

○ Two failures are a consequence of the same fault if and only if they manifest themselves through the same type of exception.

slide-11
SLIDE 11

Test Case Synthesis Algorithm

Class C { R m(C1 P1, ... , Cn Pn); } A test case for routine m above can be executed as follows: c.m(a1, .... , an) => r where c = object of Class C r = output in Type R m = routine defined in Class C aj = argument object of Type Cj for Parameter Pj

slide-12
SLIDE 12

Test Case Synthesis Algorithm (Cont.)

slide-13
SLIDE 13

Using AutoTest

  • Contract based testing tool.

○ Allows easy plug-in of testing strategies.

  • Composed of two processes

○ Test Generator / Driver ○ Interpreter

  • AutoTest runs for a duration of the set time.
slide-14
SLIDE 14

Number of Faults

  • Will different runs of random testing with

different seeds for the pseudo-random number generator reveal a similar number of faults?

  • Will the faults be the same?
slide-15
SLIDE 15

Number of Faults in Eiffel Library

Experimental Setup

  • 27 classes
  • Each class was tested for 30 sessions of 90

mins

  • Each session had a different seed to

initialize the pseudo-random number generator.

  • Total testing time was 30 * 27 * 90 = 50.6

days

slide-16
SLIDE 16

Number of Faults in Eiffel Library

Experimental Results

  • Is random testing predictable? Two kinds of

predictability:

○ Number of faults ○ Identity of faults and find if it is likely to detect the same faults regardless of the experiments was selected

  • Normalized results give us aggregated

results.

slide-17
SLIDE 17

Number of Faults

slide-18
SLIDE 18
slide-19
SLIDE 19
slide-20
SLIDE 20
slide-21
SLIDE 21
slide-22
SLIDE 22
slide-23
SLIDE 23

Conclusion

Results

  • On average, 30% of the faults found during

experiments are found after 10 mins. After 90 mins, 8% points, on average of the

  • verall number of randomly detected faults

are found.

  • Relative to the number of detected faults,

random+ is highly predictable.

  • Different runs of the testing process reveal

different faults.

slide-24
SLIDE 24

Questions?