Search in sources :

Example 16 with Description

use of org.junit.runner.Description in project junit4 by junit-team.

the class JUnit38SortingTest method preferRecentlyFailed38Test.

@Test
public void preferRecentlyFailed38Test() {
    Request request = Request.classes(JUnit4Test.class, JUnit38Test.class);
    fMax.run(request);
    List<Description> tests = fMax.sortedLeavesForTest(request);
    Description dontSucceed = Description.createTestDescription(JUnit38Test.class, "testFails");
    assertEquals(dontSucceed, tests.get(0));
}
Also used : Description(org.junit.runner.Description) Request(org.junit.runner.Request) Test(org.junit.Test)

Example 17 with Description

use of org.junit.runner.Description in project junit4 by junit-team.

the class MaxStarterTest method preferFast.

@Test
public void preferFast() {
    Request request = Request.aClass(TwoUnEqualTests.class);
    fMax.run(request);
    Description thing = fMax.sortedLeavesForTest(request).get(1);
    assertEquals(Description.createTestDescription(TwoUnEqualTests.class, "slow"), thing);
}
Also used : Description(org.junit.runner.Description) Request(org.junit.runner.Request) Test(org.junit.Test)

Example 18 with Description

use of org.junit.runner.Description in project junit4 by junit-team.

the class MaxStarterTest method preferRecentlyFailed.

@Test
public void preferRecentlyFailed() {
    Request request = Request.aClass(TwoTests.class);
    fMax.run(request);
    List<Description> tests = fMax.sortedLeavesForTest(request);
    Description dontSucceed = Description.createTestDescription(TwoTests.class, "dontSucceed");
    assertEquals(dontSucceed, tests.get(0));
}
Also used : Description(org.junit.runner.Description) Request(org.junit.runner.Request) Test(org.junit.Test)

Example 19 with Description

use of org.junit.runner.Description in project junit4 by junit-team.

the class MaxStarterTest method sortTestsInMultipleClasses.

@Test
public void sortTestsInMultipleClasses() {
    Request request = Request.classes(Computer.serial(), TwoTests.class, TwoTests.class);
    fMax.run(request);
    List<Description> tests = fMax.sortedLeavesForTest(request);
    Description dontSucceed = Description.createTestDescription(TwoTests.class, "dontSucceed");
    assertEquals(dontSucceed, tests.get(0));
    assertEquals(dontSucceed, tests.get(1));
}
Also used : Description(org.junit.runner.Description) Request(org.junit.runner.Request) Test(org.junit.Test)

Example 20 with Description

use of org.junit.runner.Description in project junit4 by junit-team.

the class FailedConstructionTest method failedConstructionIsTestFailure.

@Test
public void failedConstructionIsTestFailure() {
    Result result = JUnitCore.runClasses(CantConstruct.class);
    Failure failure = result.getFailures().get(0);
    Description expected = Description.createTestDescription(CantConstruct.class, "foo");
    Assert.assertEquals(expected, failure.getDescription());
}
Also used : Description(org.junit.runner.Description) Failure(org.junit.runner.notification.Failure) Result(org.junit.runner.Result) Test(org.junit.Test)

Aggregations

Description (org.junit.runner.Description)182 Test (org.junit.Test)84 Failure (org.junit.runner.notification.Failure)40 Result (org.junit.runner.Result)27 ArrayList (java.util.ArrayList)20 Request (org.junit.runner.Request)20 RunListener (org.junit.runner.notification.RunListener)19 JUnitCore (org.junit.runner.JUnitCore)16 IOException (java.io.IOException)13 Method (java.lang.reflect.Method)12 Filter (org.junit.runner.manipulation.Filter)11 JUnit4TestListener (com.intellij.junit4.JUnit4TestListener)10 Runner (org.junit.runner.Runner)9 RunNotifier (org.junit.runner.notification.RunNotifier)9 ComparisonFailure (org.junit.ComparisonFailure)8 InOrder (org.mockito.InOrder)8 TestSuiteModel (com.google.testing.junit.runner.model.TestSuiteModel)7 Statement (org.junit.runners.model.Statement)7 Subscribe (com.google.common.eventbus.Subscribe)6 Step (gherkin.formatter.model.Step)6