Search in sources :

Example 26 with TestListener

use of fr.inria.stamp.test.listener.TestListener in project dspot by STAMP-project.

the class TestLauncherTest method testLauncherWithResourcesInsideTheSourcesFolders.

@Test
public void testLauncherWithResourcesInsideTheSourcesFolders() throws Exception {
    Utils.init("src/test/resources/project-with-resources/project-with-resources.properties");
    final CtClass aClass = Utils.findClass("textresources.in.sources.TestResourcesInSources");
    final String classPath = AmplificationHelper.getClassPath(Utils.getCompiler(), Utils.getInputConfiguration());
    final TestListener run = TestLauncher.run(Utils.getInputConfiguration(), classPath, aClass);
    assertEquals(1, run.getPassingTests().size());
    assertEquals(1, run.getRunningTests().size());
    assertEquals(0, run.getFailingTests().size());
    assertTrue(run.getFailingTests().isEmpty());
}
Also used : CtClass(spoon.reflect.declaration.CtClass) TestListener(fr.inria.stamp.test.listener.TestListener) Test(org.junit.Test)

Example 27 with TestListener

use of fr.inria.stamp.test.listener.TestListener in project dspot by STAMP-project.

the class DefaultTestRunnerTest method testRunTestMethods.

@Test
public void testRunTestMethods() throws Exception {
    TestRunner runner = new DefaultTestRunner(new String[] { "src/test/resources/example-0.0.1-SNAPSHOT.jar", "src/test/resources/example-0.0.1-SNAPSHOT-tests.jar" });
    TestListener results = runner.run("example.TestSuiteExample", Arrays.asList(new String[] { "test3", "test1" }));
    assertEquals(2, results.getRunningTests().size());
    assertEquals(1, results.getFailingTests().size());
    assertEquals(1, results.getPassingTests().size());
    assertEquals(0, results.getAssumptionFailingTests().size());
    assertEquals(0, results.getIgnoredTests().size());
}
Also used : TestListener(fr.inria.stamp.test.listener.TestListener) Test(org.junit.Test)

Example 28 with TestListener

use of fr.inria.stamp.test.listener.TestListener in project dspot by STAMP-project.

the class DefaultTestRunnerTest method testParameterizedTestSpecificMethod.

@Test
public void testParameterizedTestSpecificMethod() throws Exception {
    TestRunner runner = new DefaultTestRunner(new String[] { "src/test/resources/parametized-0.0.1-SNAPSHOT.jar", "src/test/resources/parametized-0.0.1-SNAPSHOT-tests.jar" });
    TestListener results = runner.run("example.ConstructorParameterizedTest", "test_addTwoNumber");
    assertEquals(5, results.getRunningTests().size());
    assertEquals(0, results.getFailingTests().size());
    assertEquals(5, results.getPassingTests().size());
    assertEquals(0, results.getAssumptionFailingTests().size());
    assertEquals(0, results.getIgnoredTests().size());
}
Also used : TestListener(fr.inria.stamp.test.listener.TestListener) Test(org.junit.Test)

Example 29 with TestListener

use of fr.inria.stamp.test.listener.TestListener in project dspot by STAMP-project.

the class DefaultTestRunnerTest method testParameterizedTest.

@Test
public void testParameterizedTest() throws Exception {
    /*
            test the stamp.fr.inria.runner on parametized test:
                - Injection of parameters with constructors
                - Injection of parameters with fields
         */
    TestRunner runner = new DefaultTestRunner(new String[] { "src/test/resources/parametized-0.0.1-SNAPSHOT.jar", "src/test/resources/parametized-0.0.1-SNAPSHOT-tests.jar" });
    TestListener results = runner.run("example.ConstructorParameterizedTest");
    assertEquals(10, results.getRunningTests().size());
    assertEquals(0, results.getFailingTests().size());
    assertEquals(10, results.getPassingTests().size());
    assertEquals(0, results.getAssumptionFailingTests().size());
    assertEquals(0, results.getIgnoredTests().size());
    results = runner.run("example.ParameterizedTest");
    assertEquals(5, results.getRunningTests().size());
    assertEquals(0, results.getFailingTests().size());
    assertEquals(5, results.getPassingTests().size());
    assertEquals(0, results.getAssumptionFailingTests().size());
    assertEquals(0, results.getIgnoredTests().size());
}
Also used : TestListener(fr.inria.stamp.test.listener.TestListener) Test(org.junit.Test)

Example 30 with TestListener

use of fr.inria.stamp.test.listener.TestListener in project dspot by STAMP-project.

the class MockitoTestRunnerTest method testRunTestClass.

@Test
public void testRunTestClass() throws Exception {
    TestRunner runner = new DefaultTestRunner("src/test/resources/MockitoDemo-1.0-SNAPSHOT.jar" + System.getProperty("path.separator") + "src/test/resources/MockitoDemo-1.0-SNAPSHOT-tests.jar");
    TestListener results = runner.run("info.sanaulla.dal.BookDALTest");
    assertEquals(5, results.getRunningTests().size());
    assertEquals(1, results.getFailingTests().size());
    assertEquals(4, results.getPassingTests().size());
    assertEquals(0, results.getAssumptionFailingTests().size());
    assertEquals(0, results.getIgnoredTests().size());
}
Also used : TestListener(fr.inria.stamp.test.listener.TestListener) Test(org.junit.Test)

Aggregations

TestListener (fr.inria.stamp.test.listener.TestListener)30 Test (org.junit.Test)20 IOException (java.io.IOException)8 InputConfiguration (fr.inria.diversify.utils.sosiefier.InputConfiguration)7 File (java.io.File)7 Failure (org.junit.runner.notification.Failure)6 CtMethod (spoon.reflect.declaration.CtMethod)6 CtType (spoon.reflect.declaration.CtType)6 AmplificationHelper (fr.inria.diversify.utils.AmplificationHelper)5 DSpotUtils (fr.inria.diversify.utils.DSpotUtils)5 DSpotCompiler (fr.inria.diversify.utils.compilation.DSpotCompiler)5 TestCompiler (fr.inria.diversify.utils.compilation.TestCompiler)5 Collectors (java.util.stream.Collectors)5 Description (org.junit.runner.Description)5 Logger (org.slf4j.Logger)5 LoggerFactory (org.slf4j.LoggerFactory)5 CtClass (spoon.reflect.declaration.CtClass)5 Amplifier (fr.inria.diversify.dspot.amplifier.Amplifier)3 AssertGenerator (fr.inria.diversify.dspot.assertGenerator.AssertGenerator)3 TestSelector (fr.inria.diversify.dspot.selector.TestSelector)3