use of org.evosuite.testcase.DefaultTestCase in project evosuite by EvoSuite.
the class FixedLengthTestChromosomeFactory method getRandomTestCase.
/**
* Create a random individual
*
* @param size
*/
private TestCase getRandomTestCase(int size) {
TestCase test = new DefaultTestCase();
int num = 0;
TestFactory testFactory = TestFactory.getInstance();
// Then add random stuff
while (test.size() < size && num < Properties.MAX_ATTEMPTS) {
testFactory.insertRandomStatement(test, test.size() - 1);
num++;
}
return test;
}
use of org.evosuite.testcase.DefaultTestCase in project evosuite by EvoSuite.
the class DiversityObserver method getSuiteSimilarity.
/**
* Naive similarity comparison between suites simply consists of merging all tests to a single test
* for each suite, and then comparing these tests
*
* @param suite1
* @param suite2
* @return
*/
public static double getSuiteSimilarity(TestSuiteChromosome suite1, TestSuiteChromosome suite2) {
TestCase test1 = new DefaultTestCase();
for (TestCase test : suite1.getTests()) {
for (Statement s : test) {
// These are not valid tests as the variables still point to the original test
// but that doesn't matter as we're not executing the test
test1.addStatement(s);
}
}
TestCase test2 = new DefaultTestCase();
for (TestCase test : suite2.getTests()) {
for (Statement s : test) {
test2.addStatement(s);
}
}
return getNeedlemanWunschScore(test1, test2);
}
use of org.evosuite.testcase.DefaultTestCase in project evosuite by EvoSuite.
the class ConcolicExecutionTest method testCase81.
@Test
public void testCase81() throws SecurityException, NoSuchMethodException {
DefaultTestCase tc = buildTestCase81();
List<BranchCondition> branch_conditions = executeTest(tc);
assertEquals(1, branch_conditions.size());
}
use of org.evosuite.testcase.DefaultTestCase in project evosuite by EvoSuite.
the class ConcolicExecutionTest method testCase46.
@Test
public void testCase46() throws SecurityException, NoSuchMethodException {
DefaultTestCase tc = buildTestCase46();
List<BranchCondition> branch_conditions = executeTest(tc);
assertEquals(10, branch_conditions.size());
}
use of org.evosuite.testcase.DefaultTestCase in project evosuite by EvoSuite.
the class ConcolicExecutionTest method testCase90.
@Test
public void testCase90() throws SecurityException, NoSuchMethodException {
DefaultTestCase tc = buildTestCase90();
List<BranchCondition> branch_conditions = executeTest(tc);
assertEquals(3, branch_conditions.size());
}
Aggregations