use of org.evosuite.junit.JUnitTestReader in project evosuite by EvoSuite.
the class JUnitTestParsedChromosomeFactory method readTestCase.
private Set<TestCase> readTestCase(String fileName) {
JUnitTestReader parser = new JUnitTestReader();
Set<TestCase> tests = new HashSet<TestCase>();
System.out.print("* Parsing tests from " + fileName + ": ");
tests.addAll(parser.readTests(fileName).values());
System.out.println(". Parsed " + tests.size() + " test cases");
return tests;
}
use of org.evosuite.junit.JUnitTestReader in project evosuite by EvoSuite.
the class TestTestCaseExpander method testSomeAssignments.
@Test
public void testSomeAssignments() {
Properties.PROJECT_PREFIX = "org.evosuite.testsuite";
JUnitTestReader reader = new JUnitTestReader(null, new String[] { SRCDIR });
TestCase testCase = reader.readJUnitTestCase(ArrayTestExample1.class.getName() + "#test2");
testCase.clone();
String code = testCase.toCode();
TestCaseExpander expander = new TestCaseExpander();
TestCase expandedTest = expander.expandTestCase(testCase);
String expandedCode = expandedTest.toCode();
Assert.assertEquals(testCase.size() + 14, expandedTest.size());
Assert.assertFalse(code.equals(expandedCode));
}
use of org.evosuite.junit.JUnitTestReader in project evosuite by EvoSuite.
the class TestTestCaseExpander method testArrayAssignment.
@Test
public void testArrayAssignment() {
Properties.PROJECT_PREFIX = "org.evosuite.testsuite";
JUnitTestReader reader = new JUnitTestReader(null, new String[] { SRCDIR });
TestCase testCase = reader.readJUnitTestCase(ArrayTestExample1.class.getName() + "#test5");
testCase.clone();
String code = testCase.toCode();
TestCaseExpander expander = new TestCaseExpander();
TestCase expandedTest = expander.expandTestCase(testCase);
String expandedCode = expandedTest.toCode();
Assert.assertEquals("Wrong length of test: " + expandedCode + ", original test: " + code, testCase.size() + 1, expandedTest.size());
Assert.assertFalse(code.equals(expandedCode));
}
use of org.evosuite.junit.JUnitTestReader in project evosuite by EvoSuite.
the class TestTestCaseExpander method testOneAssignments.
@Test
public void testOneAssignments() {
Properties.PROJECT_PREFIX = "org.evosuite.testsuite";
JUnitTestReader reader = new JUnitTestReader(null, new String[] { SRCDIR });
TestCase testCase = reader.readJUnitTestCase(ArrayTestExample1.class.getName() + "#test4");
testCase.clone();
String code = testCase.toCode();
TestCaseExpander expander = new TestCaseExpander();
TestCase expandedTest = expander.expandTestCase(testCase);
String expandedCode = expandedTest.toCode();
Assert.assertEquals("Wrong length of test: " + expandedCode + ", original test: " + code, testCase.size() + 2, expandedTest.size());
Assert.assertFalse(code.equals(expandedCode));
}
use of org.evosuite.junit.JUnitTestReader in project evosuite by EvoSuite.
the class TestTestCaseExpander method testHiddenAssignments.
@Test
public void testHiddenAssignments() {
Properties.PROJECT_PREFIX = "org.evosuite.testsuite";
JUnitTestReader reader = new JUnitTestReader(null, new String[] { SRCDIR });
TestCase testCase = reader.readJUnitTestCase(ArrayTestExample1.class.getName() + "#test3");
testCase.clone();
String code = testCase.toCode();
TestCaseExpander expander = new TestCaseExpander();
TestCase expandedTest = expander.expandTestCase(testCase);
String expandedCode = expandedTest.toCode();
Assert.assertEquals("Wrong length of test: " + expandedCode, testCase.size() + 24, expandedTest.size());
Assert.assertFalse(code.equals(expandedCode));
}
Aggregations