use of org.evosuite.testcase.TestCase in project evosuite by EvoSuite.
the class MutationAssertionSystemTest method test1.
@Ignore
@Test
public void test1() {
TestSuiteChromosome suite = generateSuite(ExampleObserverClass.class);
Assert.assertTrue(suite.size() > 0);
for (TestCase test : suite.getTests()) {
Assert.assertTrue("Test has no assertions: " + test.toCode(), test.hasAssertions());
}
}
use of org.evosuite.testcase.TestCase in project evosuite by EvoSuite.
the class MutationAssertionSystemTest method test2.
@Ignore
@Test
public void test2() {
TestSuiteChromosome suite = generateSuite(ExampleFieldClass.class);
Assert.assertTrue(suite.size() > 0);
for (TestCase test : suite.getTests()) {
Assert.assertTrue("Test has no assertions: " + test.toCode(), test.hasAssertions());
}
}
use of org.evosuite.testcase.TestCase in project evosuite by EvoSuite.
the class MutationAssertionSystemTest method test4.
@Ignore
@Test
public void test4() {
TestSuiteChromosome suite = generateSuite(ExampleStaticVoidSetterClass.class);
Assert.assertTrue(suite.size() > 0);
for (TestCase test : suite.getTests()) {
if (test.size() > 1)
Assert.assertTrue("Test has no assertions: " + test.toCode(), test.hasAssertions());
}
}
use of org.evosuite.testcase.TestCase in project evosuite by EvoSuite.
the class OverloadSystemTest method testIsOverloadedInstance.
@Test
public void testIsOverloadedInstance() throws NoSuchMethodException, SecurityException {
Method m1 = Overload.class.getMethod("execute", Overload.class, Overload.class);
Method m2 = Overload.class.getMethod("execute", Overload.class, Object.class);
GenericMethod gm1 = new GenericMethod(m1, Overload.class);
GenericMethod gm2 = new GenericMethod(m2, Overload.class);
TestCase test = new DefaultTestCase();
GenericConstructor gc = new GenericConstructor(Overload.class.getConstructors()[0], Overload.class);
ConstructorStatement cs = new ConstructorStatement(test, gc, new ArrayList<VariableReference>());
VariableReference overloadInstance = test.addStatement(cs);
ConstructorStatement ocs = new ConstructorStatement(test, new GenericConstructor(Object.class.getConstructors()[0], Object.class), new ArrayList<VariableReference>());
VariableReference objectInstance = test.addStatement(ocs);
List<VariableReference> vars1 = new ArrayList<VariableReference>();
vars1.add(overloadInstance);
vars1.add(overloadInstance);
List<VariableReference> vars2 = new ArrayList<VariableReference>();
vars2.add(overloadInstance);
vars2.add(objectInstance);
Assert.assertFalse(gm1.isOverloaded(vars1));
Assert.assertTrue(gm2.isOverloaded(vars1));
Assert.assertTrue(gm1.isOverloaded(vars2));
Assert.assertFalse(gm2.isOverloaded(vars2));
}
use of org.evosuite.testcase.TestCase in project evosuite by EvoSuite.
the class CloneMeSystemTest method testCloneMe.
@Test
public void testCloneMe() {
EvoSuite evosuite = new EvoSuite();
String targetClass = CloneMe.class.getCanonicalName();
Properties.TARGET_CLASS = targetClass;
String[] command = new String[] { "-generateSuite", "-class", targetClass };
Object result = evosuite.parseCommandLine(command);
GeneticAlgorithm<?> ga = getGAFromResult(result);
TestSuiteChromosome best = (TestSuiteChromosome) ga.getBestIndividual();
System.out.println("EvolvedTestSuite:\n" + best);
List<TestCase> tests = best.getTests();
boolean allStable = TestStabilityChecker.checkStability(tests);
assertTrue(allStable);
}
Aggregations