Package randoop.test
Class ValidityCheckingGenerator
java.lang.Object
randoop.test.TestCheckGenerator
randoop.test.ValidityCheckingGenerator
A
ValidityCheckingGenerator
checks for occurrences of exceptions that have been tagged as
invalid behaviors. Also, either ignores or reports flaky test sequences --- an input sequence
that throws an exception in a longer test sequence, despite having run normally by itself.
Ignored flaky sequences are classified as invalid. Flaky occurrences of OutOfMemoryError
or StackOverflowError
are always treated as invalid.-
Field Summary
Modifier and TypeFieldDescriptionprivate boolean
If true, report flaky tests by throwing an exception. -
Constructor Summary
ConstructorDescriptionValidityCheckingGenerator
(boolean throwExceptionOnFlakyTest) Creates an object that looks for invalid exceptions. -
Method Summary
Modifier and TypeMethodDescriptionGenerate aTestChecks
object for the executed sequenceeseq
based on the criteria of this generator.Methods inherited from class randoop.test.TestCheckGenerator
hasGenerator
-
Field Details
-
throwExceptionOnFlakyTest
private boolean throwExceptionOnFlakyTestIf true, report flaky tests by throwing an exception.
-
-
Constructor Details
-
ValidityCheckingGenerator
public ValidityCheckingGenerator(boolean throwExceptionOnFlakyTest) Creates an object that looks for invalid exceptions.- Parameters:
throwExceptionOnFlakyTest
- a flag indicating whether to report flaky tests by throwing an exception
-
-
Method Details
-
generateTestChecks
Generate aTestChecks
object for the executed sequenceeseq
based on the criteria of this generator.Checks validity of a test sequence and creates a
InvalidChecks
object containing aInvalidChecks
for the first invalid exception encountered, if any. There are three possible outcomes:- An exception is seen before the last statement:
- If throwExceptionOnFlakyTest is true and the exception is not
OutOfMemoryError
orStackOverflowError
, throw an exception. - Otherwise, the sequence is invalid.
- If throwExceptionOnFlakyTest is true and the exception is not
- An exception is seen on the last statement:
- if the exception is classified as invalid, the sequence is invalid.
- otherwise, the returned InvalidChecks is empty (the sequence is valid).
- Otherwise, the returned InvalidChecks is empty (the sequence is valid).
- Specified by:
generateTestChecks
in classTestCheckGenerator
- Parameters:
eseq
- the sequence for which checks are generated- Returns:
- a possibly-empty
InvalidChecks
object for sequence - Throws:
Error
- if throwExceptionOnFlakyTest==true and exception encountered before last statement of sequence
- An exception is seen before the last statement:
-