use of org.evosuite.xsd.Project in project evosuite by EvoSuite.
the class ProjectStaticDataTest method testIsToTest_LastestGenerationFailed.
@Test
public void testIsToTest_LastestGenerationFailed() {
Project project = new Project();
project.setTotalNumberOfTestableClasses(XSDUtils.convert(1));
CUT cut = new CUT();
cut.setFullNameOfTargetClass("foo.Bar");
cut.setFullNameOfTestSuite("foo.BarTest");
Generation generation = new Generation();
generation.setId(XSDUtils.convert(0));
generation.setFailed(true);
cut.getGeneration().add(generation);
project.getCut().add(cut);
ProjectStaticData data = new ProjectStaticData();
data.setProject(project);
// if EvoSuite failed to generate a new test suite
// for CUT and because we need to get N passing
// generations to know whether the coverage improved
// or not, this CUT has to be re-tested
Assert.assertTrue(data.isToTest("foo.Bar", 3));
}
use of org.evosuite.xsd.Project in project evosuite by EvoSuite.
the class ProjectStaticDataTest method testIsToTest_ActuallyImproved.
@Test
public void testIsToTest_ActuallyImproved() {
Project project = new Project();
project.setTotalNumberOfTestableClasses(XSDUtils.convert(1));
CUT cut = new CUT();
cut.setFullNameOfTargetClass("foo.Bar");
cut.setFullNameOfTestSuite("foo.BarTest");
Generation g0 = new Generation();
g0.setId(XSDUtils.convert(0));
g0.setFailed(false);
g0.setModified(true);
g0.setTimeBudgetInSeconds(XSDUtils.convert(60));
// empty dummy test suite
g0.setSuite(new TestSuite());
// add first generation
cut.getGeneration().add(g0);
for (int i = 1; i <= 3; i++) {
Generation g = new Generation();
g.setId(XSDUtils.convert(i));
g.setFailed(false);
g.setModified(false);
g.setTimeBudgetInSeconds(XSDUtils.convert(60));
g.setSuite(new TestSuite());
cut.getGeneration().add(g);
}
project.getCut().add(cut);
ProjectStaticData data = new ProjectStaticData();
data.setProject(project);
// coverage has improved
Assert.assertTrue(data.isToTest("foo.Bar", 3));
}
use of org.evosuite.xsd.Project in project evosuite by EvoSuite.
the class StorageManagerTest method testDefaultProjectInfo.
@Test
public void testDefaultProjectInfo() {
StorageManager sm = new StorageManager();
sm.clean();
try {
Project project = StorageManager.getDatabaseProject();
Assert.assertNotNull(project);
} finally {
sm.clean();
}
}
use of org.evosuite.xsd.Project in project evosuite by EvoSuite.
the class ProjectStaticDataTest method testIsToTest_NoCUTdata.
@Test
public void testIsToTest_NoCUTdata() {
Project project = new Project();
project.setTotalNumberOfTestableClasses(XSDUtils.convert(0));
ProjectStaticData data = new ProjectStaticData();
data.setProject(project);
// there is not any generation for CUT,
// so re-test it
Assert.assertTrue(data.isToTest("foo.Bar", 3));
}
use of org.evosuite.xsd.Project in project evosuite by EvoSuite.
the class ProjectStaticDataTest method testIsToTest_OneLastNGenerationsFailed.
@Test
public void testIsToTest_OneLastNGenerationsFailed() {
Project project = new Project();
project.setTotalNumberOfTestableClasses(XSDUtils.convert(1));
CUT cut = new CUT();
cut.setFullNameOfTargetClass("foo.Bar");
cut.setFullNameOfTestSuite("foo.BarTest");
for (int i = 0; i < 5; i++) {
Generation generation = new Generation();
generation.setId(XSDUtils.convert(i));
generation.setFailed(i % 2 != 0);
generation.setModified(false);
generation.setTimeBudgetInSeconds(XSDUtils.convert(60));
cut.getGeneration().add(generation);
}
project.getCut().add(cut);
ProjectStaticData data = new ProjectStaticData();
data.setProject(project);
// to be considered has improved, all N generations
// have to end successfully
Assert.assertTrue(data.isToTest("foo.Bar", 3));
}
Aggregations