use of org.evosuite.SystemTestBase in project evosuite by EvoSuite.
the class BaseDeterminismSystemTest method run.
private static String run(Class<?> target, Runnable initializer) {
SystemTestBase scaffolding = new SystemTestBase();
ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
PrintStream outStream = new PrintStream(byteStream);
PrintStream latestOut = System.out;
System.setOut(outStream);
// @Before
scaffolding.setDefaultPropertiesForTestCases();
Properties.CRITERION = new Properties.Criterion[] { Properties.Criterion.LINE, Properties.Criterion.BRANCH, Properties.Criterion.EXCEPTION, Properties.Criterion.WEAKMUTATION, Properties.Criterion.OUTPUT, Properties.Criterion.METHOD, Properties.Criterion.METHODNOEXCEPTION, Properties.Criterion.CBRANCH };
if (initializer != null) {
initializer.run();
}
boolean defaultPrint = Properties.PRINT_TO_SYSTEM;
Properties.PRINT_TO_SYSTEM = true;
try {
EvoSuite evosuite = new EvoSuite();
String targetClass = target.getCanonicalName();
Properties.TARGET_CLASS = targetClass;
String[] command = new String[] { "-generateSuite", "-class", targetClass };
evosuite.parseCommandLine(command);
} finally {
// @After
scaffolding.resetStaticVariables();
System.setOut(latestOut);
Properties.PRINT_TO_SYSTEM = defaultPrint;
}
return filter(byteStream.toString());
}
Aggregations