use of org.evosuite.testcase.TestChromosome in project evosuite by EvoSuite.
the class RegressionSuiteMinimizer method removeUnusedVariables.
/*
* "borrowed" from TestCaseMinimizer
*/
private void removeUnusedVariables(RegressionTestSuiteChromosome suite) {
for (TestChromosome testChromosome : suite.getTestChromosomes()) {
RegressionTestChromosome test = (RegressionTestChromosome) testChromosome;
boolean changed = TestCaseMinimizer.removeUnusedVariables(test.getTheTest().getTestCase());
if (changed) {
test.updateClassloader();
executeSuite(suite);
}
}
}
use of org.evosuite.testcase.TestChromosome in project evosuite by EvoSuite.
the class RegressionSuiteMinimizer method executeTest.
/**
* Execute regression test case on both versions
*
* @param regressionTest regression test chromosome to be executed on both versions
*/
private void executeTest(RegressionTestChromosome regressionTest) {
TestChromosome testChromosome = regressionTest.getTheTest();
TestChromosome otherChromosome = regressionTest.getTheSameTestForTheOtherClassLoader();
ExecutionResult result = regressionAssertionGenerator.runTest(testChromosome.getTestCase());
ExecutionResult otherResult = regressionAssertionGenerator.runTest(otherChromosome.getTestCase());
regressionTest.setLastExecutionResult(result);
regressionTest.setLastRegressionExecutionResult(otherResult);
testChromosome.setLastExecutionResult(result);
otherChromosome.setLastExecutionResult(otherResult);
}
use of org.evosuite.testcase.TestChromosome in project evosuite by EvoSuite.
the class RegressionTestSuiteChromosomeFactory method getChromosome.
/**
* Factory to manipulate and generate method sequences
*/
/**
* {@inheritDoc}
*/
@Override
public TestSuiteChromosome getChromosome() {
RegressionTestSuiteChromosome chromosome = new RegressionTestSuiteChromosome(testChromosomeFactory);
chromosome.clearTests();
int numTests = Randomness.nextInt(Properties.MIN_INITIAL_TESTS, Properties.MAX_INITIAL_TESTS + 1);
for (int i = 0; i < numTests; i++) {
TestChromosome test = testChromosomeFactory.getChromosome();
chromosome.addTest(test);
}
// logger.trace("Generated new test suite:"+chromosome);
return chromosome;
}
use of org.evosuite.testcase.TestChromosome in project evosuite by EvoSuite.
the class RegressionTestSuiteChromosome method addTests.
@Override
public void addTests(Collection<TestChromosome> tests) {
for (TestChromosome test : tests) {
test.setChanged(true);
addTest(test);
}
}
use of org.evosuite.testcase.TestChromosome in project evosuite by EvoSuite.
the class RegressionTestSuiteChromosome method getTestSuiteForTheOtherClassLoader.
public AbstractTestSuiteChromosome<TestChromosome> getTestSuiteForTheOtherClassLoader() {
AbstractTestSuiteChromosome<TestChromosome> suite = new TestSuiteChromosome();
for (TestChromosome regressionTest : tests) {
RegressionTestChromosome rtc = (RegressionTestChromosome) regressionTest;
suite.addTest(rtc.getTheSameTestForTheOtherClassLoader());
}
return suite;
}
Aggregations