Search in sources :

Example 96 with TestResult

use of junit.framework.TestResult in project junit4 by junit-team.

the class TestCaseTest method verifyFailure.

void verifyFailure(TestCase test) {
    TestResult result = test.run();
    assertTrue(result.runCount() == 1);
    assertTrue(result.failureCount() == 1);
    assertTrue(result.errorCount() == 0);
}
Also used : TestResult(junit.framework.TestResult)

Example 97 with TestResult

use of junit.framework.TestResult in project junit4 by junit-team.

the class RepeatedTestTest method testRepeatedOnce.

public void testRepeatedOnce() {
    Test test = new RepeatedTest(fSuite, 1);
    assertEquals(2, test.countTestCases());
    TestResult result = new TestResult();
    test.run(result);
    assertEquals(2, result.runCount());
}
Also used : Test(junit.framework.Test) RepeatedTest(junit.extensions.RepeatedTest) RepeatedTest(junit.extensions.RepeatedTest) TestResult(junit.framework.TestResult)

Example 98 with TestResult

use of junit.framework.TestResult in project junit4 by junit-team.

the class ActiveTestTest method testActiveRepeatedTest0.

public void testActiveRepeatedTest0() {
    Test test = new RepeatedTest(createActiveTestSuite(), 0);
    TestResult result = new TestResult();
    test.run(result);
    assertEquals(0, result.runCount());
    assertEquals(0, result.failureCount());
    assertEquals(0, result.errorCount());
}
Also used : Test(junit.framework.Test) RepeatedTest(junit.extensions.RepeatedTest) RepeatedTest(junit.extensions.RepeatedTest) TestResult(junit.framework.TestResult)

Example 99 with TestResult

use of junit.framework.TestResult in project junit4 by junit-team.

the class ExtensionTest method testSetupErrorInTestSetup.

public void testSetupErrorInTestSetup() {
    WasRun test = new WasRun();
    TestSetup wrapper = new TestSetup(test) {

        @SuppressWarnings("deprecation")
        @Override
        public void setUp() {
            fail();
        }
    };
    TestResult result = new TestResult();
    wrapper.run(result);
    assertTrue(!test.fWasRun);
    assertTrue(!result.wasSuccessful());
}
Also used : WasRun(junit.tests.WasRun) TestSetup(junit.extensions.TestSetup) TestResult(junit.framework.TestResult)

Example 100 with TestResult

use of junit.framework.TestResult in project junit4 by junit-team.

the class ExtensionTest method testRunningErrorInTestSetup.

public void testRunningErrorInTestSetup() {
    TestCase test = new TestCase("failure") {

        @Override
        public void runTest() {
            fail();
        }
    };
    TestSetup wrapper = new TestSetup(test);
    TestResult result = new TestResult();
    wrapper.run(result);
    assertTrue(!result.wasSuccessful());
}
Also used : TestSetup(junit.extensions.TestSetup) TestCase(junit.framework.TestCase) TestResult(junit.framework.TestResult)

Aggregations

TestResult (junit.framework.TestResult)108 TestSuite (junit.framework.TestSuite)33 Test (junit.framework.Test)19 JUnit4TestAdapter (junit.framework.JUnit4TestAdapter)17 TestCase (junit.framework.TestCase)14 TestFailure (junit.framework.TestFailure)12 Test (org.junit.Test)10 TestListener (junit.framework.TestListener)9 ArrayList (java.util.ArrayList)8 PrintStream (java.io.PrintStream)7 RepeatedTest (junit.extensions.RepeatedTest)7 Enumeration (java.util.Enumeration)6 Bundle (android.os.Bundle)5 HandlerThread (android.os.HandlerThread)5 ShellUiAutomatorBridge (com.android.uiautomator.core.ShellUiAutomatorBridge)5 Tracer (com.android.uiautomator.core.Tracer)5 UiAutomationShellWrapper (com.android.uiautomator.core.UiAutomationShellWrapper)5 AssertionFailedError (junit.framework.AssertionFailedError)5 IOException (java.io.IOException)4 Iterator (java.util.Iterator)4