Search in sources :

Example 81 with TestResult

use of junit.framework.TestResult in project BTW by TechnionYearlyProject.

the class QueryTrafficLightExample method testGetAllTrafficLights.

/*
     * @author Sharon Hadar
     * @Date 21/01/2018*/
@Test
public void testGetAllTrafficLights() {
    TestResult result = new TestResult();
    MainDataBase.openConnection();
    Query query = new QueryTrafficLightExample("first");
    // MainDataBase database = new MainDataBase();
    // Set<TrafficLight> trafficLights = (Set<TrafficLight>) database.queryDataBase(query);
    Set<TrafficLight> trafficLights = (Set<TrafficLight>) MainDataBase.queryDataBase(query);
    Iterator<TrafficLight> iterator = trafficLights.iterator();
    // System.out.println("\n\n\nthe result set is:");
    while (iterator.hasNext()) {
        assertNotNull(iterator.next());
    // System.out.println(iterator.next().toString());
    }
    MainDataBase.closeConnection();
}
Also used : Set(java.util.Set) HashSet(java.util.HashSet) ResultSet(java.sql.ResultSet) Query(il.ac.technion.cs.yp.btw.db.queries.Query) DataTrafficLight(il.ac.technion.cs.yp.btw.db.DataObjects.DataTrafficLight) TrafficLight(il.ac.technion.cs.yp.btw.classes.TrafficLight) TestResult(junit.framework.TestResult) Test(org.junit.Test)

Example 82 with TestResult

use of junit.framework.TestResult in project BTW by TechnionYearlyProject.

the class QueryTrafficLightExample method testGetAllCenteralLocations.

/*
     * @author Sharon Hadar
     * @Date 21/01/2018*/
@Test
public void testGetAllCenteralLocations() {
    TestResult result = new TestResult();
    MainDataBase.openConnection();
    Query query = new QueryCenteralLocationExample("first");
    // MainDataBase database = new MainDataBase();
    // Set<CentralLocation> centeralLocations = (Set<CentralLocation>) database.queryDataBase(query);
    Set<CentralLocation> centeralLocations = (Set<CentralLocation>) MainDataBase.queryDataBase(query);
    Iterator<CentralLocation> iterator = centeralLocations.iterator();
    // System.out.println("\n\n\nthe result set is:");
    while (iterator.hasNext()) {
        assertNotNull(iterator.next());
    // System.out.println(iterator.next().toString());
    }
    MainDataBase.closeConnection();
}
Also used : Set(java.util.Set) HashSet(java.util.HashSet) ResultSet(java.sql.ResultSet) Query(il.ac.technion.cs.yp.btw.db.queries.Query) CentralLocation(il.ac.technion.cs.yp.btw.classes.CentralLocation) TestResult(junit.framework.TestResult) Test(org.junit.Test)

Example 83 with TestResult

use of junit.framework.TestResult in project BTW by TechnionYearlyProject.

the class QueryTrafficLightExample method testGetAllRoadsSet.

// the test method name needs to begin with the word 'test'
/*
     * @author Sharon Hadar
     * @Date 21/01/2018*/
@Test
public void testGetAllRoadsSet() {
    TestResult result = new TestResult();
    MainDataBase.openConnection();
    Query query = new QueryRoadExample("first");
    // MainDataBase database = new MainDataBase();
    // Set<Road> roads = (Set<Road>) database.queryDataBase(query);
    Set<Road> roads = (Set<Road>) MainDataBase.queryDataBase(query);
    Iterator<Road> iterator = roads.iterator();
    // System.out.println("\n\n\nthe result set is:");
    while (iterator.hasNext()) {
        assertNotNull(iterator.next());
    // System.out.println(iterator.next().toString());
    }
    MainDataBase.closeConnection();
}
Also used : Set(java.util.Set) HashSet(java.util.HashSet) ResultSet(java.sql.ResultSet) Query(il.ac.technion.cs.yp.btw.db.queries.Query) DataRoad(il.ac.technion.cs.yp.btw.db.DataObjects.DataRoad) Road(il.ac.technion.cs.yp.btw.classes.Road) TestResult(junit.framework.TestResult) Test(org.junit.Test)

Example 84 with TestResult

use of junit.framework.TestResult in project streamsupport by stefan-zobel.

the class JSR166TestCase method main.

/**
 * Runs all unit tests in the given test suite.
 * Actual behavior influenced by jsr166.* system properties.
 */
static void main(Test suite, String[] args) {
    if (useSecurityManager) {
        System.err.println("Setting a permissive security manager");
        Policy.setPolicy(permissivePolicy());
        System.setSecurityManager(new SecurityManager());
    }
    for (int i = 0; i < suiteRuns; i++) {
        TestResult result = newPithyTestRunner().doRun(suite);
        if (!result.wasSuccessful())
            System.exit(1);
        System.gc();
        System.runFinalization();
    }
}
Also used : TestResult(junit.framework.TestResult)

Example 85 with TestResult

use of junit.framework.TestResult in project narayana by jbosstm.

the class TestRunner method execute.

/**
 * Execute the specific test against the specified participant.
 * @param participantURI The URI of the participant.
 * @param testTimeout The test timeout.
 * @param asyncTest The asynchronous test flag.
 * @param testName The name of the test to execute.
 * @return The test result.
 */
public static TestResult execute(final String participantURI, final long testTimeout, final boolean asyncTest, final String testName) {
    MessageLogging.clearThreadLog();
    final Test test;
    if (TestConstants.NAME_ALL_TESTS.equals(testName)) {
        final TestSuite testSuite = new TestSuite();
        testSuite.addTest(new InteropTestSuite(participantURI, testTimeout, asyncTest, AT_TEST_CLASS));
        testSuite.addTest(new InteropTestSuite(participantURI, testTimeout, asyncTest, BA_TEST_CLASS));
        test = testSuite;
    } else if (TestConstants.NAME_ALL_AT_TESTS.equals(testName)) {
        test = new InteropTestSuite(participantURI, testTimeout, asyncTest, AT_TEST_CLASS);
    } else if (TestConstants.NAME_ALL_BA_TESTS.equals(testName)) {
        test = new InteropTestSuite(participantURI, testTimeout, asyncTest, BA_TEST_CLASS);
    } else if (testName.startsWith(TestConstants.PREFIX_AT_TESTS)) {
        final Class testClass = AT_TEST_CLASS;
        try {
            test = createTest(testClass, participantURI, testTimeout, asyncTest, testName);
        } catch (final Throwable th) {
            System.err.println("Unexpected error instantiating test class: " + th);
            return null;
        }
    } else if (testName.startsWith(TestConstants.PREFIX_BA_TESTS)) {
        final Class testClass = BA_TEST_CLASS;
        try {
            test = createTest(testClass, participantURI, testTimeout, asyncTest, testName);
        } catch (final Throwable th) {
            System.err.println("Unexpected error instantiating test class: " + th);
            return null;
        }
    } else {
        System.err.println("Unidentified test name: " + testName);
        return null;
    }
    MessageLogging.appendThreadLog(LOG_MESSAGE_PREFIX);
    final TestResult testResult = new FullTestResult();
    test.run(testResult);
    MessageLogging.appendThreadLog(LOG_MESSAGE_SUFFIX);
    return testResult;
}
Also used : InteropTestSuite(com.jboss.transaction.txinterop.interop.InteropTestSuite) TestSuite(junit.framework.TestSuite) InteropTestSuite(com.jboss.transaction.txinterop.interop.InteropTestSuite) Test(junit.framework.Test) 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