Search in sources :

Example 56 with TestResult

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

the class TestCaseTest method verifyError.

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

Example 57 with TestResult

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

the class TestCaseTest method verifySuccess.

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

Example 58 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 59 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 60 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)80 TestSuite (junit.framework.TestSuite)25 JUnit4TestAdapter (junit.framework.JUnit4TestAdapter)15 TestCase (junit.framework.TestCase)13 Test (junit.framework.Test)11 TestFailure (junit.framework.TestFailure)8 RepeatedTest (junit.extensions.RepeatedTest)7 TestListener (junit.framework.TestListener)7 Test (org.junit.Test)7 PrintStream (java.io.PrintStream)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 ResultPrinter (junit.textui.ResultPrinter)4 Enumeration (java.util.Enumeration)3 TestSetup (junit.extensions.TestSetup)3 AssertionFailedError (junit.framework.AssertionFailedError)3 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2