use of org.evosuite.testcase.factories.JUnitTestCarvedChromosomeFactory in project evosuite by EvoSuite.
the class JUnitTestCarvedChromosomeFactorySystemTest method testCarvedTestNames.
@Test
public void testCarvedTestNames() {
Properties.TARGET_CLASS = MethodWithSeveralInputArguments.class.getCanonicalName();
;
Properties.SELECTED_JUNIT = TestMethodWithSeveralInputArguments.class.getCanonicalName();
;
Properties.SEED_MUTATIONS = 1;
Properties.SEED_CLONE = 1;
JUnitTestCarvedChromosomeFactory factory = new JUnitTestCarvedChromosomeFactory(null);
Assert.assertEquals("Incorrect number of carved tests", 2, factory.getNumCarvedTestCases());
CarvedTestCase tc1 = (CarvedTestCase) factory.getCarvedTestCases().get(0);
Assert.assertEquals("Incorrect carved test name", "testWithNull", tc1.getName());
System.out.println("Carved Test Case # " + tc1.getID() + ": " + tc1.getName());
System.out.println(tc1.toCode());
CarvedTestCase tc2 = (CarvedTestCase) factory.getCarvedTestCases().get(1);
Assert.assertEquals("Incorrect carved test name", "testWithArray", tc2.getName());
System.out.println("Carved Test Case # " + tc2.getID() + ": " + tc2.getName());
System.out.println(tc2.toCode());
}
use of org.evosuite.testcase.factories.JUnitTestCarvedChromosomeFactory in project evosuite by EvoSuite.
the class JUnitTestCarvedChromosomeFactorySystemTest method testBeanDateConverterUtils7.
@Test
public void testBeanDateConverterUtils7() {
Properties.SELECTED_JUNIT = com.examples.with.different.packagename.testcarver.DateConverterTest7.class.getCanonicalName();
Properties.TARGET_CLASS = com.examples.with.different.packagename.testcarver.DateConverter.class.getCanonicalName();
Properties.SEED_MUTATIONS = 1;
Properties.SEED_CLONE = 1;
Properties.CHOP_CARVED_EXCEPTIONS = false;
JUnitTestCarvedChromosomeFactory factory = new JUnitTestCarvedChromosomeFactory(null);
Assert.assertEquals(1, factory.getNumCarvedTestCases());
String code = factory.getChromosome().getTestCase().toCode();
System.out.println(code);
}
use of org.evosuite.testcase.factories.JUnitTestCarvedChromosomeFactory in project evosuite by EvoSuite.
the class JUnitTestCarvedChromosomeFactorySystemTest method testPersonExample.
@Test
public void testPersonExample() {
Properties.SELECTED_JUNIT = com.examples.with.different.packagename.testcarver.TestPerson.class.getCanonicalName();
Properties.TARGET_CLASS = com.examples.with.different.packagename.testcarver.Person.class.getCanonicalName();
Properties.SEED_MUTATIONS = 1;
Properties.SEED_CLONE = 1;
JUnitTestCarvedChromosomeFactory factory = new JUnitTestCarvedChromosomeFactory(null);
Assert.assertTrue(factory.hasCarvedTestCases());
TestChromosome carved = factory.getChromosome();
Assert.assertNotNull(carved);
String code = carved.toString();
Assert.assertEquals(code, 3, carved.test.size());
}
use of org.evosuite.testcase.factories.JUnitTestCarvedChromosomeFactory in project evosuite by EvoSuite.
the class JUnitTestCarvedChromosomeFactorySystemTest method testBeanDateConverterUtils4.
@Test
public void testBeanDateConverterUtils4() {
Properties.SELECTED_JUNIT = com.examples.with.different.packagename.testcarver.DateConverterTest4.class.getCanonicalName();
Properties.TARGET_CLASS = com.examples.with.different.packagename.testcarver.DateConverter.class.getCanonicalName();
Properties.SEED_MUTATIONS = 1;
Properties.SEED_CLONE = 1;
JUnitTestCarvedChromosomeFactory factory = new JUnitTestCarvedChromosomeFactory(null);
Assert.assertEquals(1, factory.getNumCarvedTestCases());
String code = factory.getChromosome().getTestCase().toCode();
System.out.println(code);
}
use of org.evosuite.testcase.factories.JUnitTestCarvedChromosomeFactory in project evosuite by EvoSuite.
the class JUnitTestCarvedChromosomeFactorySystemTest method testBeanDateConverterUtils.
@Test
public void testBeanDateConverterUtils() {
Properties.SELECTED_JUNIT = com.examples.with.different.packagename.testcarver.DateConverterTestCase.class.getCanonicalName();
Properties.TARGET_CLASS = com.examples.with.different.packagename.testcarver.DateConverter.class.getCanonicalName();
Properties.SEED_MUTATIONS = 1;
Properties.SEED_CLONE = 1;
JUnitTestCarvedChromosomeFactory factory = new JUnitTestCarvedChromosomeFactory(null);
Assert.assertEquals(11, factory.getNumCarvedTestCases());
}
Aggregations