L4 Flashcards

(31 cards)

1
Q

Korat

A

whitebox, systematic testing tool for linked data structures

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Randoop

A

feedback-directed random testing for classes and libraries

creates new test guided by feedback from previous tests

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

problem with automated testing

A
  • inf tests
  • even a finite subset can be huge
  • need to be concise (avoid illegal and redundant tests) and diverse (give good coverage)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

small test case hypothesis

A
  • if there is any test that cause the program to fail, there is small such test.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

how to generate inputs

A
  • use the types
  • class declaration shows what values can fill each field
  • enumerate all possible deviation deviations from a fix set of objects
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Korat algorithm

A
  • generates all possible input up to user-defined k
  • discards inputs where pre-condition is false
  • runs the program on remaining inputs
  • check results using post-condition
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

The total number of candidate vectors/shapes for a at-most 3 node binary tree in Korat?

A

7 fields, 4 choices each -> 4^7, but we are only interested in 9 of them

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

The total number of candidate vectors/shapes for an at-most k node binary tree in Korat?

A

(k+1)^(2k+1)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

steps Korat follows

A
  • initiate candidate vectors (all null)
  • expand the last field accessed by the pre-condition
  • backtrack if all possibilities for a field are exhausted
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Korat’s strength

A
  • when we can enumerate all possibilities

- for linked data structures, small, easily specified procedures, unit testing

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Korat’s weakness

A
  • when enumeration is weak

- only as good as the pre and post conditions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Randoop’s recipe

A

randomly create new test guided by feedback from previously created tests

  • build new sequences incrementally
  • as soon as a sequence is created, execute it
  • use results to guide test generation toward sequences that create new obj states
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Randoop’s input

A
  • classes under test
  • time limit
  • set of contract
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

condition for violating test cases to exist in the output of Randoop

A
  • no contract should be violated up the the end of the sequence
  • the final assertion should fail
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Randoop’s algorithm

A

Create new sequence:

  • randomly picks a method m returning T
  • for each Ti, pick Si from components that construct object Vi
  • assemble n randomly picked sequences to create Snew

Classify new sequence: discard/ output as test/ add to components

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

illegal sequence

A
  • sequences that crash before the contract is checked

- violates some precondition during execution

17
Q

redundant sequences

A
  • randoop maintains a set of all objects created in execution of each sequence
  • new seq is redundant if obj created in its execution belongs to the above set.
  • could also use more sophisticated state equivalent methods
18
Q

use type information to guide test generation is a characteristic of

A

both Korat and Randoop

19
Q

each test is fully independent of the past tests is a characteristic of

20
Q

generate test deterministically is a characteristic of

21
Q

suited to test method seq is a characteristic of

22
Q

Avoid generating redundant test is a characteristic of

A

both Korat and Randoop

23
Q

if a list function works for lists of length 0 to 3, what conclusion can we draw?

A

it probably works for all lists

24
Q

korat’s precondition technique

A
  • add code to observe its actions
  • record fields accessed by the pre-condition
  • if the pre-condition doesn’t access a field, it doesn’t depend on the field.
25
korat's enumerating tests
- shapes are enumerated by associated vectors + initial: all field null + next shape generated by expanding last field accessed in pre-condition & backtracking if all possibilities for a field are exhausted
26
key idea for enumerating tests
- never expand parts of input not examined by pre-condition | - cleverly checks for and discard shapes isomorphic to previously generated shapes
27
Randoop stands for
Random tester for object-oriented programs
28
problem with uniform random testing
creates too many illegal and redundant tests
29
Randoop's output
contact-violating test cases
30
randoop redundant sequence technique's drawbacks
- might miss bugs that can only be trigger by extending a sequence - might also mistakenly redeem redundant sequences as not redundant
31
why didn't automated test generation become popular earlier?
- earlier program languages has weak type systems while automated test generation relies heavily on type information. - contemporary languages fit better for test generation