Class GenInputsAbstract
- Direct Known Subclasses:
GenTests
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
The possible values for exception behavior types.static enum
The possible modes for updating the coverage information that is used by Bloodhound.static enum
The possible values of the literals_level command-line argument.static enum
Possible behaviors if Randoop generates a flaky test.static enum
static class
Wraps the three ways of limiting Randoop test generation.static enum
The possible values of the method_selection command-line argument. -
Field Summary
Modifier and TypeFieldDescriptionstatic double
Try to reuse values from a sequence with the given frequency.static int
Maximum number of attempts to generate a test method candidate.static boolean
Print to standard out, method weights and method uncovered ratios.Bloodhound can update coverage information at a regular interval that is either based on time or on the number of successful invocations.static boolean
static boolean
Whether to check that generated sequences can be compiled.If a test throws a checked exception, should it be included in the error-revealing test suite (value: ERROR), regression test suite (value: EXPECTED), or should it be discarded (value: INVALID)?static Path
File that lists classes to test.static int
Clear the component set each time it contains the given number of inputs.static long
Clear the component set each time Randoop uses this much memory.If a test throws aConcurrentModificationException
exception, should it be included in the error-revealing test suite (value: ERROR), regression test suite (value: EXPECTED), or should it be discarded (value: INVALID)?static boolean
static boolean
If true, Randoop is deterministic: running Randoop twice with the same arguments (including--randomseed
) will produce the same test suite, so long as the program under test is deterministic.static boolean
Include methods that are otherwise omitted by default.static boolean
Run test generation without output.static boolean
Create sequences but never execute them.static String
Base name (no ".java" suffix) of the JUnit file containing error-revealing testsstatic boolean
(For debugging.) If an error or exception is thrown during type instantiation or input selection, this option allows the error to be passed through toGenTests.handle(String[])
where a comprehensive error message is printed.What to do if Randoop generates a flaky test.static boolean
Do not usenull
as input to methods or constructors, even when no other argument value can be generated.static int
Maximum number of test method candidates generated internally.static boolean
Make Randoop proceed, instead of failing, if the Java condition text of a specification cannot be compiled.static boolean
Make Randoop treat a specification whose execution throws an exception as returningfalse
.static boolean
If true, don't print diagnostics about specification that throw an exception.Randoop generates new tests by combining old previously-generated tests.static String
Name of file containing code text to be added to the@AfterClass
-annotated method of each generated test class.static String
Name of file containing code text to be added to the@After
-annotated method of each generated test class.static String
Name of file containing code text to be added to the@BeforeClass
-annotated method of each generated test class.static String
Name of file containing code text to be added to the@Before
-annotated method of each generated test class.static String
Name of the directory in which JUnit files should be written.static String
Name of the package for the generated JUnit files.static boolean
Whether to use JUnit's standard reflective mechanisms for invoking tests.static String
How much memory Randoop should use when starting new JVMs.private static int
A file containing literal values to be used as inputs to methods under test, or "CLASSES".How to use literal values that are specified via the--literals-file
command-line option.static org.plumelib.util.FileWriterWithName
A file to which to log lots of information.static int
Do not generate tests with more than this many statements.Randoop generates new tests by choosing from a set of methods under test.static Path
A file containing a list of methods and constructors to call in tests, each given as a fully-qualified signature on a separate line.static boolean
If true, Randoop outputs both original error-revealing tests and a minimized version.If a test throws aNoClassDefFoundError
exception, should it be included in the error-revealing test suite (value: ERROR), regression test suite (value: EXPECTED), or should it be discarded (value: INVALID)?static boolean
Whether to output error-revealing tests.static boolean
Whether to include assertions in regression tests.static boolean
Whether to output regression tests.static int
How many suspected side-effecting or nondeterministic methods (from the program under test) to print.If a test that never passesnull
as an argument throws aNullPointerException
, should the test be included in the error-revealing test suite (value: ERROR), regression test suite (value: EXPECTED), or should it be discarded (value: INVALID)?If a test that passesnull
as an argument throws aNullPointerException
, should the test be be included in the error-revealing test suite (value: ERROR), regression test suite (value: EXPECTED), or should it be discarded (value: INVALID)?static double
Use null with the given frequency as an argument to method calls.A regex that indicates classes that should not be used in tests, even if included by some other command-line option.A file containing a list of regular expressions that indicate classes not to call in a test.static boolean
Include classes that are otherwise omitted by default.A fully-qualified field name of a field to be excluded from test generation.static Path
File that contains fully-qualified field names to be excluded from test generation.static Path
File that contains fully-qualified field names to be excluded from test generation.A regex that indicates methods that should not be called directly in generated tests.A file containing a list of regular expressions that indicate methods that should not be included in generated tests.static boolean
Include methods that are otherwise omitted by default.static boolean
Restrict tests to only include public members of classes.If a test throws anOutOfMemoryError
exception, should it be included in the error-revealing test suite (value: ERROR), regression test suite (value: EXPECTED), or should it be discarded (value: INVALID)?static org.plumelib.util.FileWriterWithName
A file to which to write operation usage, when Randoop exits.static int
The maximum number of regression and error-revealing tests to output.static boolean
True if Randoop should print generated tests that do not compile, which indicate Randoop bugs.static boolean
static long
static long
static long
static int
The random seed to use in the generation process.static String
Base name (no ".java" suffix) of the JUnit file containing regression testsstatic boolean
static Pattern
Classes that must occur in a test.static Path
File containing binary names of classes that the tests must use, directly or indirectly.static org.plumelib.util.FileWriterWithName
A file to which to log selections; helps find sources of non-determinism.static Path
File containing side-effect-free methods, each given as a fully-qualified signature on a separate line.static boolean
If a test throws aStackOverflowError
exception, should it be included in the error-revealing test suite (value: ERROR), regression test suite (value: EXPECTED), or should it be discarded (value: INVALID)?Read file of specifications; see manual section "Specifying expected code behavior".static boolean
Stop generation as soon as one error-revealing test has been generated.static int
Maximum length of strings in generated tests, including in assertions.System properties that Randoop will set similarly tojava -D
, of the form "x=y".Package to test.The fully-qualified raw name of a class to test; for example,--testclass=java.util.TreeSet
.Treat every class in the given jar file as a class to test.static int
Maximum number of tests to write to each JUnit file.static int
Maximum number of seconds to spend generating tests.If a test throws an unchecked exception other thanConcurrentModificationException
,NoClassDefFoundError
,NullPointerException
,OutOfMemoryError
, andStackOverflowError
, should the test be included in the error-revealing test suite (value: ERROR), regression test suite (value: EXPECTED), or should it be discarded (value: INVALID)?static boolean
Use built-in specifications for JDK classes and for classes that inherit from them, as if they had been supplied using the--specifications
command-line argument.Install the given runtime visitor. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Check that the options given satisfy any specified constraints, and fail if they do not.getClassesWithPackageFromDirectory
(File directory, String packageName, AccessibilityPredicate accessibility) Given a directory on the CLASSPATH, returns classes in the given package.getClassesWithPackageFromJar
(File jarFile, String packageName, AccessibilityPredicate accessibility) Returns classes with the given package in the given jar file.getClassnamesFromArgs
(AccessibilityPredicate accessibility) Read names of classes under test, as provided with the --classlist or --testjar command-line argument.getClassNamesFromFile
(Path file) Returns the class names listed in the file.getClassnamesFromJarFile
(Path jarFile, AccessibilityPredicate accessibility) Read names of classes from a jar file.getClassnamesFromPackage
(String packageName, AccessibilityPredicate accessibility) Returns classes from the classpath that are in the given package.getStringSetFromFile
(@Nullable Path listFile, String fileDescription, String commentRegex, String includeRegex) Returns a set consisting of the lines of the file.getStringSetFromFile
(Path listFile, String fileDescription) Returns a set consisting of the lines of the file, except those starting with "#".private static boolean
shouldOmitClass
(String classname) Returns true if the class should be omitted, according to theomit_classes
field.Methods inherited from class randoop.main.CommandHandler
handle, handles, printHTML, usageMessage
-
Field Details
-
testjar
Treat every class in the given jar file as a class to test. The jarfile must be on the classpath.See the notes about specifying methods that may appear in a test.
-
test_package
Package to test. All classes on the classpath within the package are classes to test. Does not include classes in sub-packages.The classes in the package are tested in addition to any specified using
--testjar
,--testclass
, and--classlist
-
classlist
File that lists classes to test. All of their methods are methods under test.In the file, each class under test is specified by its binary name on a separate line. See an example. These classes are tested in addition to any specified using
--testjar
,--test-package
, and--testclass
.Using
--classlist
is less common than--testjar
. See the notes about specifying methods that may appear in a test. -
testclass
The fully-qualified raw name of a class to test; for example,--testclass=java.util.TreeSet
. All of its methods are methods under test. This class is tested in addition to any specified using--testjar
,--test-package
, and--classlist
.It is unusual to specify just one or a few classes to test. See the notes about specifying methods that may appear in a test.
-
methodlist
A file containing a list of methods and constructors to call in tests, each given as a fully-qualified signature on a separate line.These methods augment any methods from classes given by the
--testjar
,--classlist
, and--testclass
options.See an example file.
Using
--methodlist
is less common, and more error-prone, than--testjar
,--test-package
,--classlist
, or--testclass
. See the notes about specifying methods that may appear in a test. -
omit_classes
A regex that indicates classes that should not be used in tests, even if included by some other command-line option. The regex is matched against fully-qualified class names. If the regular expression contains anchors "^
" or "$
", they refer to the beginning and the end of the class name. -
omit_classes_file
A file containing a list of regular expressions that indicate classes not to call in a test. These patterns are used along with those provided with--omit-classes
. -
omit_methods
A regex that indicates methods that should not be called directly in generated tests. This does not prevent indirect calls to such methods from other, allowed methods; to prevent them, see thereplacecall
agent.Randoop will not directly call a method whose fully-qualified signature matches the regular expression, or a method inherited from a superclass or interface whose signature matches the regular expression.
If the regular expression contains anchors "
^
" or "$
", they refer to the beginning and the end of the signature string.Methods replaced by the
replacecall
agent are also automatically omitted. -
omit_methods_file
A file containing a list of regular expressions that indicate methods that should not be included in generated tests. These patterns are used along with those provided with--omit-methods
, and the default omissions. -
omit_methods_no_defaults
public static boolean omit_methods_no_defaultsInclude methods that are otherwise omitted by default. Unless you set this to true, every method replaced by thereplacecall
agent is treated as if it had been supplied as an argument to--omit-methods
. -
omit_classes_no_defaults
public static boolean omit_classes_no_defaultsInclude classes that are otherwise omitted by default. -
dont_omit_replaced_methods
public static boolean dont_omit_replaced_methodsInclude methods that are otherwise omitted by default. Unless you set this to true, every method replaced by thereplacecall
agent is treated as if it had been supplied as an argument to--omit-methods
. -
omit_field
A fully-qualified field name of a field to be excluded from test generation. An accessible field is used unless it is omitted by this or the--omit-field-file
option. -
omit_field_file
File that contains fully-qualified field names to be excluded from test generation. An accessible field is used unless it is omitted by this or the--omit-field
option. -
omit_field_list
File that contains fully-qualified field names to be excluded from test generation. An accessible field is used unless it is omitted by this or the--omit-field
option. -
only_test_public_members
public static boolean only_test_public_membersRestrict tests to only include public members of classes.When this is false, the setting of
--junit-package-name
and package accessibility is used to determine which members will be used in tests. -
silently_ignore_bad_class_names
public static boolean silently_ignore_bad_class_names -
fail_on_generation_error
public static boolean fail_on_generation_error(For debugging.) If an error or exception is thrown during type instantiation or input selection, this option allows the error to be passed through toGenTests.handle(String[])
where a comprehensive error message is printed. -
flaky_test_behavior
What to do if Randoop generates a flaky test. A flaky test is one that behaves differently on different executions.Flaky tests are usually due to calling Randoop on side-effecting or nondeterministic methods, and ultimately, the solution is not to call Randoop on such methods; see section Nondeterminism in the Randoop manual.
-
nondeterministic_methods_to_output
public static int nondeterministic_methods_to_outputHow many suspected side-effecting or nondeterministic methods (from the program under test) to print. -
no_error_revealing_tests
public static boolean no_error_revealing_testsWhether to output error-revealing tests. Disables all output when used with--no-regression-tests
. Restricting output can result in long runs if the default values of--generated-limit
and--time-limit
are used. -
no_regression_tests
public static boolean no_regression_testsWhether to output regression tests. Disables all output when used with--no-error-revealing-tests
. Restricting output can result in long runs if the default values of--generated-limit
and--time-limit
are used. -
no_regression_assertions
public static boolean no_regression_assertionsWhether to include assertions in regression tests. If false, then the regression tests contain no assertions (except that if the test throws an exception, it should continue to throw an exception of the same type). Tests without assertions can be used to exercise the code, but they do not enforce any particular behavior, such as values returned. -
check_compilable
public static boolean check_compilableWhether to check that generated sequences can be compiled. If true, the code for each generated sequence is compiled, and the sequence is only kept if the compilation succeeds without error. This check is useful because the assumptions in Randoop generation heuristics are sometimes violated by input methods, and, as a result, a generated test may not compile. This check does increases the runtime by approximately 50%. -
require_classname_in_test
Classes that must occur in a test. Randoop will only output tests whose source code has at least one use of a member of a class whose name matches the regular expression. -
require_covered_classes
File containing binary names of classes that the tests must use, directly or indirectly. This option only works if Randoop is run using the covered-class javaagent to instrument the classes. A test is output only if it uses at least one of the class names in the file. A test uses a class if it invokes any constructor or method of the class, directly or indirectly (the constructor or method might not appear in the source code of the test). Included classes may be abstract. -
minimize_error_test
public static boolean minimize_error_testIf true, Randoop outputs both original error-revealing tests and a minimized version. Setting this option may cause long Randoop run times if Randoop outputs and minimizes more than about 100 error-revealing tests; consider using--stop-on-error-test=true
. Also see the test case minimization options. -
checked_exception
If a test throws a checked exception, should it be included in the error-revealing test suite (value: ERROR), regression test suite (value: EXPECTED), or should it be discarded (value: INVALID)? -
unchecked_exception
If a test throws an unchecked exception other thanConcurrentModificationException
,NoClassDefFoundError
,NullPointerException
,OutOfMemoryError
, andStackOverflowError
, should the test be included in the error-revealing test suite (value: ERROR), regression test suite (value: EXPECTED), or should it be discarded (value: INVALID)?The arguments
--cm-exception
,--ncdf-exception
,--npe-on-null-input
,--npe-on-non-null-input
,--oom-exception
, and--sof-exception
handle special cases of unchecked exceptions. -
cm_exception
If a test throws aConcurrentModificationException
exception, should it be included in the error-revealing test suite (value: ERROR), regression test suite (value: EXPECTED), or should it be discarded (value: INVALID)? -
ncdf_exception
If a test throws aNoClassDefFoundError
exception, should it be included in the error-revealing test suite (value: ERROR), regression test suite (value: EXPECTED), or should it be discarded (value: INVALID)? -
npe_on_null_input
If a test that passesnull
as an argument throws aNullPointerException
, should the test be be included in the error-revealing test suite (value: ERROR), regression test suite (value: EXPECTED), or should it be discarded (value: INVALID)? -
npe_on_non_null_input
If a test that never passesnull
as an argument throws aNullPointerException
, should the test be included in the error-revealing test suite (value: ERROR), regression test suite (value: EXPECTED), or should it be discarded (value: INVALID)? -
oom_exception
If a test throws anOutOfMemoryError
exception, should it be included in the error-revealing test suite (value: ERROR), regression test suite (value: EXPECTED), or should it be discarded (value: INVALID)? -
sof_exception
If a test throws aStackOverflowError
exception, should it be included in the error-revealing test suite (value: ERROR), regression test suite (value: EXPECTED), or should it be discarded (value: INVALID)? -
specifications
Read file of specifications; see manual section "Specifying expected code behavior". -
use_jdk_specifications
public static boolean use_jdk_specificationsUse built-in specifications for JDK classes and for classes that inherit from them, as if they had been supplied using the--specifications
command-line argument. -
ignore_condition_compilation_error
public static boolean ignore_condition_compilation_errorMake Randoop proceed, instead of failing, if the Java condition text of a specification cannot be compiled. -
ignore_condition_exception
public static boolean ignore_condition_exceptionMake Randoop treat a specification whose execution throws an exception as returningfalse
. If true, Randoop treatsx.f == 22
equivalently to the wordierx != null && x.f == 22
. If false, Randoop halts when a specification throws an exception. -
ignore_condition_exception_quiet
public static boolean ignore_condition_exception_quietIf true, don't print diagnostics about specification that throw an exception. Has no effect unless--ignore-condition-exception
is set. -
side_effect_free_methods
File containing side-effect-free methods, each given as a fully-qualified signature on a separate line. Specifying side-effect-free methods has two benefits: it makes regression tests stronger, and it helps Randoop create smaller tests. -
time_limit
public static int time_limitMaximum number of seconds to spend generating tests. Zero means no limit. If nonzero, Randoop is nondeterministic: it may generate different test suites on different runs.This is the overall limit, not the limit per class under test. The default value is too small to be effective for generating tests for an entire project. If you are testing multiple classes, you may wish to multiply the default value by the number of classes under test.
Randoop may run for longer than this because of a long-running test. The elapsed time is checked after each test, not during a test's execution.
-
LIMIT_DEFAULT
private static int LIMIT_DEFAULT -
attempted_limit
public static int attempted_limitMaximum number of attempts to generate a test method candidate. -
generated_limit
public static int generated_limitMaximum number of test method candidates generated internally. -
output_limit
public static int output_limitThe maximum number of regression and error-revealing tests to output. If there is no output, this limit has no effect. There is no output when using either--dont-output-tests
or--no-error-revealing-tests
together with--no-regression-tests
.In the current implementation, the number of tests in the output can be substantially smaller than this limit. One reason is that Randoop does not output subsumed tests, which appear as a subsequence of some longer test.
-
maxsize
public static int maxsizeDo not generate tests with more than this many statements. -
stop_on_error_test
public static boolean stop_on_error_testStop generation as soon as one error-revealing test has been generated. Implies--minimize-error-test
. -
null_ratio
public static double null_ratioUse null with the given frequency as an argument to method calls.For example, a null ratio of 0.05 directs Randoop to use
null
as an input 5 percent of the time when a non-null
value of the appropriate type is available.Unless --forbid_null is true, a
null
value will still be used if no other value can be passed as an argument even if --null-ratio=0.Randoop never uses
null
for receiver values. -
forbid_null
public static boolean forbid_nullDo not usenull
as input to methods or constructors, even when no other argument value can be generated.If true, Randoop will not generate a test when unable to find a non-null value of appropriate type as an input. This could result in certain class members being untested.
-
literals_file
A file containing literal values to be used as inputs to methods under test, or "CLASSES".Literals in these files are used in addition to all other constants in the pool. For the format of this file, see documentation in class
LiteralFileReader
. The special value "CLASSES" (with no quotes) means to read literals from all classes under test. -
literals_level
How to use literal values that are specified via the--literals-file
command-line option.- See Also:
-
method_selection
Randoop generates new tests by choosing from a set of methods under test. This controls how the next method is chosen, from among all methods under test. -
bloodhound_logging
public static boolean bloodhound_loggingPrint to standard out, method weights and method uncovered ratios. -
bloodhound_update_mode
Bloodhound can update coverage information at a regular interval that is either based on time or on the number of successful invocations. -
string_maxlen
public static int string_maxlenMaximum length of strings in generated tests, including in assertions. Strings longer than 65KB (or about 10,000 characters) may be rejected by the Java compiler, according to the Java Virtual Machine specification. -
alias_ratio
public static double alias_ratioTry to reuse values from a sequence with the given frequency. If an alias ratio is given, it should be between 0 and 1.A ratio of 0 results in tests where each value created within a test input is typically used at most once as an argument in a method call. A ratio of 1 tries to maximize the number of times values are used as inputs to parameters within a test.
-
input_selection
Randoop generates new tests by combining old previously-generated tests. This controls how the old tests are chosen, from among all existing tests. -
clear
public static int clearClear the component set each time it contains the given number of inputs.Randoop stores previously-generated tests in a "component" set, and uses them to generate new tests. Setting this variable to a small number can sometimes result in a greater variety of tests generated during a single run.
-
clear_memory
public static long clear_memoryClear the component set each time Randoop uses this much memory.Setting this variable to a smaller number may prevent an out-of-memory exception or a run that is slow due to thrashing and garbage collection.
-
testsperfile
public static int testsperfileMaximum number of tests to write to each JUnit file. -
error_test_basename
Base name (no ".java" suffix) of the JUnit file containing error-revealing tests -
regression_test_basename
Base name (no ".java" suffix) of the JUnit file containing regression tests -
junit_package_name
Name of the package for the generated JUnit files. Enables testing non-public members. Tests can be restricted to public members only by also using the option--only-test-public-members
. -
junit_before_each
Name of file containing code text to be added to the@Before
-annotated method of each generated test class. Code is uninterpreted, and, so, is not run during generation. Intended for use when run-time behavior of classes under test requires setup behavior that is not needed for execution by reflection. (The annotation@Before
is JUnit 4, and@BeforeEach
is JUnit 5.) -
junit_after_each
Name of file containing code text to be added to the@After
-annotated method of each generated test class. Intended for use when run-time behavior of classes under test requires tear-down behavior that is not needed for execution by reflection. Code is uninterpreted, and, so, is not run during generation. (The annotation@After
is JUnit 4, and@AfterEach
is JUnit 5.) -
junit_before_all
Name of file containing code text to be added to the@BeforeClass
-annotated method of each generated test class. Intended for use when run-time behavior of classes under test requires setup behavior that is not needed for execution by reflection. Code is uninterpreted, and, so, is not run during generation. (The annotation@BeforeClass
is JUnit 4, and@BeforeAll
is JUnit 5.) -
junit_after_all
Name of file containing code text to be added to the@AfterClass
-annotated method of each generated test class. Intended for use when run-time behavior of classes under test requires tear-down behavior that is not needed for execution by reflection. Code is uninterpreted, and, so, is not run during generation. (The annotation@AfterClass
is JUnit 4, and@AfterAll
is JUnit 5.) -
junit_output_dir
Name of the directory in which JUnit files should be written. -
dont_output_tests
public static boolean dont_output_testsRun test generation without output. May be desirable when running with a visitor.NOTE: Because there is no output, the value of
--output-limit
will never be met, so be sure to set--generated-limit
or--time-limit
to a reasonable value when using this option. -
junit_reflection_allowed
public static boolean junit_reflection_allowedWhether to use JUnit's standard reflective mechanisms for invoking tests. JUnit's reflective invocations can interfere with code instrumentation, such as by the DynComp tool. If that is a problem, then set this to false and Randoop will output tests that use direct method calls instead of reflection. The tests will include amain
method and will execute methods and assertions, but won't be JUnit suites. -
system_props
System properties that Randoop will set similarly tojava -D
, of the form "x=y". -
jvm_max_memory
How much memory Randoop should use when starting new JVMs. This only affects new JVMs; you still need to supply-Xmx...
when starting Randoop itself. -
capture_output
public static boolean capture_output -
randomseed
public static int randomseedThe random seed to use in the generation process. You do not need to provide this option to make Randoop deterministic, because Randoop is deterministic by default. It is recommended to run Randoop multiple times with a different random seed, in order to produce multiple different test suites. -
deterministic
public static boolean deterministicIf true, Randoop is deterministic: running Randoop twice with the same arguments (including--randomseed
) will produce the same test suite, so long as the program under test is deterministic. If false, Randoop may or may not produce the same test suite. To produce multiple different test suites, use the--randomseed
command-line option. -
progressdisplay
public static boolean progressdisplay -
PROGRESSINTERVALMILLIS_DEFAULT
public static long PROGRESSINTERVALMILLIS_DEFAULT -
progressintervalmillis
public static long progressintervalmillis -
progressintervalsteps
public static long progressintervalsteps -
debug_checks
public static boolean debug_checks -
log
public static org.plumelib.util.FileWriterWithName logA file to which to log lots of information. If not specified, no logging is done. Enabling the logs slows down Randoop. -
selection_log
public static org.plumelib.util.FileWriterWithName selection_logA file to which to log selections; helps find sources of non-determinism. If not specified, no logging is done. -
operation_history_log
public static org.plumelib.util.FileWriterWithName operation_history_logA file to which to write operation usage, when Randoop exits. -
print_non_compiling_file
public static boolean print_non_compiling_fileTrue if Randoop should print generated tests that do not compile, which indicate Randoop bugs. -
dontexecute
public static boolean dontexecuteCreate sequences but never execute them. Used to test performance of Randoop's sequence generation code. -
visitor
Install the given runtime visitor. See class randoop.ExecutionVisitor. -
repeat_heuristic
public static boolean repeat_heuristic
-
-
Constructor Details
-
GenInputsAbstract
-
-
Method Details
-
checkOptionsValid
public void checkOptionsValid()Check that the options given satisfy any specified constraints, and fail if they do not. -
shouldOmitClass
Returns true if the class should be omitted, according to theomit_classes
field.- Parameters:
classname
- a class name- Returns:
- true if the class should be omitted
-
getClassnamesFromArgs
Read names of classes under test, as provided with the --classlist or --testjar command-line argument.- Parameters:
accessibility
- the accessibility predicate- Returns:
- the classes provided via the --classlist or --testjar command-line argument
-
getClassnamesFromJarFile
public static Set<@ClassGetName String> getClassnamesFromJarFile(Path jarFile, AccessibilityPredicate accessibility) Read names of classes from a jar file. Ignores interfaces, abstract classes, non-accessible classes, and those that cannot be loaded.- Parameters:
jarFile
- the jar file from which to read classesaccessibility
- the accessibility predicate- Returns:
- the names of classes in the jar file
-
getClassnamesFromPackage
private static List<@ClassGetName String> getClassnamesFromPackage(String packageName, AccessibilityPredicate accessibility) Returns classes from the classpath that are in the given package. Does not include classes in sub-packages. Ignores non-accessible classes.- Parameters:
packageName
- a package name; may be the empty stringaccessibility
- the accessibility predicate- Returns:
- classes in package
packageName
-
getClassesWithPackageFromDirectory
private static List<@ClassGetName String> getClassesWithPackageFromDirectory(File directory, String packageName, AccessibilityPredicate accessibility) Given a directory on the CLASSPATH, returns classes in the given package. These classes are found in a subdirectory of the given directory, whose name depends on the given package.- Parameters:
directory
- a directory on the CLASSPATHpackageName
- a package nameaccessibility
- the accessibility predicate- Returns:
- classes with the given package
-
getClassesWithPackageFromJar
private static List<@ClassGetName String> getClassesWithPackageFromJar(File jarFile, String packageName, AccessibilityPredicate accessibility) Returns classes with the given package in the given jar file.- Parameters:
jarFile
- a jar file containing classespackageName
- a package nameaccessibility
- the accessibility predicate- Returns:
- classes in package
packageName
in the given jar file
-
getClassNamesFromFile
Returns the class names listed in the file.- Parameters:
file
- the file containing the strings- Returns:
- the lines in the file, or null if listFile is null
-
getStringSetFromFile
Returns a set consisting of the lines of the file, except those starting with "#". Returns empty set if listFile is null.- Parameters:
listFile
- the file containing the stringsfileDescription
- string used in error messages- Returns:
- the lines in the file, or null if listFile is null
-
getStringSetFromFile
public static Set<String> getStringSetFromFile(@Nullable Path listFile, String fileDescription, String commentRegex, String includeRegex) Returns a set consisting of the lines of the file. Returns empty set if listFile is null.- Parameters:
listFile
- the file containing the stringsfileDescription
- string used in error messagescommentRegex
- indicates which lines are comments that should be ignoredincludeRegex
- if this string appears in the file, then another file is recursively read- Returns:
- the strings in the file, or null if listFile is null
-