use of org.evosuite.Properties.AssertionStrategy in project evosuite by EvoSuite.
the class RegressionSuiteSerializer method getAppendedRegressionSuiteArchive.
/**
* Get (and append) a coverage-based test suite archive for regression testing
*/
private static TestSuiteChromosome getAppendedRegressionSuiteArchive() {
List<TestChromosome> previousArchive = TestSuiteSerialization.loadTests(REGRESSION_ARCHIVE_FILE);
LoggingUtils.getEvoLogger().info("* previousArchive.size(): " + previousArchive.size());
previousArchive.forEach(t -> t.getTestCase().removeAssertions());
// execute previous regression test archive
removeTestsThatDoNotcompile(previousArchive);
Properties.TEST_ARCHIVE = false;
TestSuiteChromosome archiveSuite = new TestSuiteChromosome();
archiveSuite.addTests(previousArchive);
BranchCoverageSuiteFitness branchCoverageSuiteFitness = new BranchCoverageSuiteFitness(TestGenerationContext.getInstance().getClassLoaderForSUT());
// execute the test suite
branchCoverageSuiteFitness.getFitness(archiveSuite);
LoggingUtils.getEvoLogger().info("* archive covered goals: " + archiveSuite.getCoveredGoals().size());
Properties.TEST_ARCHIVE = true;
TestSuiteChromosome testArchive = Archive.getArchiveInstance().mergeArchiveAndSolution(archiveSuite);
LoggingUtils.getEvoLogger().info("* newArchive.size(): " + testArchive.size());
LoggingUtils.getEvoLogger().info("* new covered goals: " + testArchive.getCoveredGoals().size());
// add all assertions
AssertionStrategy tmpStrategy = Properties.ASSERTION_STRATEGY;
Properties.ASSERTION_STRATEGY = AssertionStrategy.ALL;
TestSuiteGeneratorHelper.addAssertions(testArchive);
Properties.ASSERTION_STRATEGY = tmpStrategy;
return testArchive;
}
Aggregations