public static void main(String args[]) {
   if (args.length > 0) {
     junit.framework.TestSuite s = new TestSuite();
     for (int i = 0; i < args.length; i++) {
       s.addTest(new AsTest(args[i]));
     }
     junit.textui.TestRunner.run(s);
   } else junit.textui.TestRunner.run(AsTest.class);
 }
  public void runSingleJunitTest(String className) {
    Throwable excep = null;
    int index = className.lastIndexOf('$');
    String testName = "";
    String originalClassName = className;
    if (index >= 0) {
      className = className.substring(0, index);
      testName = originalClassName.substring(index + 1);
    }
    try {
      Class clazz = mContext.getClassLoader().loadClass(className);
      if (mJUnitClass.isAssignableFrom(clazz)) {
        junit.framework.TestCase test = (junit.framework.TestCase) clazz.newInstance();
        JunitTestSuite newSuite = new JunitTestSuite();
        test.setName(testName);

        if (test instanceof AndroidTestCase) {
          AndroidTestCase testcase = (AndroidTestCase) test;
          try {
            testcase.setContext(mContext);
          } catch (Exception ex) {
            Log.w(TAG, "Exception encountered while trying to set the context.", ex);
          }
        }
        newSuite.addTest(test);

        if (mMode == PERFORMANCE) {
          try {
            started(test.toString());
            runInPerformanceMode(test, className, true, test.toString());
            finished(test.toString());
            if (excep == null) {
              passed(test.toString());
            } else {
              failed(test.toString(), excep);
            }
          } catch (Throwable ex) {
            excep = ex;
          }

        } else if (mMode == PROFILING) {
          startProfiling();
          junit.textui.TestRunner.run(newSuite);
          finishProfiling();
        } else {
          junit.textui.TestRunner.run(newSuite);
        }
      }
    } catch (ClassNotFoundException e) {
      Log.e("TestHarness", "No test case to run", e);
    } catch (IllegalAccessException e) {
      Log.e("TestHarness", "Illegal Access Exception", e);
    } catch (InstantiationException e) {
      Log.e("TestHarness", "Instantiation Exception", e);
    }
  }
Beispiel #3
0
 /**
  * Launch the test.
  *
  * @param args the command line arguments
  * @generatedBy CodePro at 18/10/13 19:08
  */
 public static void main(String[] args) {
   if (args.length == 0) {
     // Run all of the tests
     junit.textui.TestRunner.run(EC2WorkerTest.class);
   } else {
     // Run only the named tests
     TestSuite suite = new TestSuite("Selected tests");
     for (int i = 0; i < args.length; i++) {
       TestCase test = new EC2WorkerTest();
       test.setName(args[i]);
       suite.addTest(test);
     }
     junit.textui.TestRunner.run(suite);
   }
 }
Beispiel #4
0
 /**
  * This method facilitates running tests from a single entry point outside of ant (i.e. for
  * androide, WCE, etc.).
  */
 public static void main(String[] args) {
   if (args.length == 0) {
     junit.textui.TestRunner.run(NativeTest.class);
   } else {
     if (args.length == 1 && "all".equals(args[0])) {
       args =
           new String[] {
             "com.sun.jna.NativeTest",
             "com.sun.jna.NativeLibraryTest",
             "com.sun.jna.PointerTest",
             "com.sun.jna.MemoryTest",
             "com.sun.jna.LibraryLoadTest",
             "com.sun.jna.ArgumentsMarshalTest",
             "com.sun.jna.ReturnTypesTest",
             "com.sun.jna.TypeMapperTest",
             "com.sun.jna.ByReferenceArgumentsTest",
             "com.sun.jna.LastErrorTest",
             "com.sun.jna.StructureTest", // 1 wce failure (RO fields)
             "com.sun.jna.StructureByValueTest",
             "com.sun.jna.UnionTest",
             "com.sun.jna.IntegerTypeTest",
             "com.sun.jna.VMCrashProtectionTest",
             "com.sun.jna.CallbacksTest",
             "com.sun.jna.JNAUnloadTest",
             "com.sun.jna.DirectTest",
             "com.sun.jna.DirectArgumentsMarshalTest",
             "com.sun.jna.DirectByReferenceArgumentsTest",
             "com.sun.jna.DirectTypeMapperTest",
             "com.sun.jna.DirectReturnTypesTest",
             "com.sun.jna.DirectStructureByValueTest",
             "com.sun.jna.DirectCallbacksTest",
           };
     }
     System.out.println("Test suites: " + args.length);
     for (int i = 0; i < args.length; i++) {
       System.out.println("Running tests on class " + args[i]);
       try {
         junit.textui.TestRunner.run((Class<? extends TestCase>) Class.forName(args[i]));
       } catch (Throwable e) {
         e.printStackTrace();
       }
     }
     try {
       Thread.sleep(300000);
     } catch (Exception e) {
     }
   }
 }
Beispiel #5
0
  /** @param args the command line arguments */
  public static void main(String[] args) {
    // Get cmd line args
    boolean ok = true;
    for (int i = 0; i < args.length; ) {
      if (args[i].equalsIgnoreCase("-m")) {
        bridgeName = ++i < args.length ? args[i++] : "";
      } else if (args[i].equalsIgnoreCase("-tport")) {
        transportName = ++i < args.length ? args[i++] : "";
      } else if (args[i].equals("-s")) {
        symbol = ++i < args.length ? args[i++] : "";
      } else if (args[i].equals("-S")) {
        source = ++i < args.length ? args[i++] : "";
      } else if (args[i].equals("-badsource")) {
        badsource = ++i < args.length ? args[i++] : "";
      } else {
        ok = false; // error
        break;
      }
    }
    if (!ok || bridgeName.isEmpty() || transportName.isEmpty()) {
      System.err.println("Usage: Main -m bridgeName -tport transportName");
      System.exit(1);
    }

    // Each test will load/unload Mama as needed
    java.util.logging.Level level = Mama.getLogLevel(); // force load of the shared libs

    // Run the test suite
    junit.textui.TestRunner.run(suite());

    System.exit(0); // TODO temporary - not exiting JVM - daemon thread?
  }
 public static void main(String args[]) {
   System.setProperty("file.encoding", "UTF-8");
   if (args.length > 0) {
     file = args[0];
   }
   TestRunner.run(suite());
 }
Beispiel #7
0
 public static void main(String args[]) {
   try {
     junit.textui.TestRunner.run(suite());
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
Beispiel #8
0
  /**
   * Utility main method. This will the test cases defined in this class.
   *
   * <p>Usage: java NamedListTest
   */
  public static void main(String[] args) {
    /* junit.textui.TestRunner will write the test results to stdout. */
    junit.textui.TestRunner.run(NamedListTest.class);

    /* junit.swingui.TestRunner will display the test results in JUnit's
    swing interface. */
    // junit.swingui.TestRunner.run (NamedListTest.class);
  }
Beispiel #9
0
 public static void main(String[] args) {
   try {
     TestRunner.run(suite());
   } catch (Throwable t) {
     System.out.println("Throwable: " + t.getClass().getName() + " Message: " + t.getMessage());
     t.printStackTrace();
   }
 }
  public static void main(String[] args) {

    try {
      junit.textui.TestRunner.run(suite());
    } catch (Exception e) {
      System.out.println(e);
    }
  }
 public static void main(String[] args) throws Exception {
   if (args.length == 1) {
     url = new URL(args[0]);
   } else {
     url = new URL(new SimpleRpcEncServiceLocator().getSimpleRpcEncPortAddress());
   }
   junit.textui.TestRunner.run(new junit.framework.TestSuite(SimpleRpcEncServiceTestCase.class));
 } // main
 public static void main(String[] args) {
   junit.framework.TestResult tr = junit.textui.TestRunner.run(suite());
   if (tr.errorCount() > 0 || tr.failureCount() > 0) {
     System.exit(1);
   } else {
     System.exit(0);
   }
 }
Beispiel #13
0
 /**
  * main method for the junit testing.
  *
  * @param args - unused
  */
 public static void main(String[] args) {
   junit.textui.TestRunner runner = new junit.textui.TestRunner();
   System.exit(
       TestRunner.run(
                   runner.getTest(uk.ac.shef.wit.simmetrics.arbitrators.TestSuite.class.getName()))
               .wasSuccessful()
           ? 0
           : 1);
 }
  /**
   * This method allows to easily run this unit test independent of the other unit tests, and
   * without dealing with Ant or unrelated test suites.
   */
  public static void main(String[] sa) {
    if (sa.length > 0 && sa[0].startsWith("-g")) {
      junit.swingui.TestRunner.run(OdbcPacketOutputStreamTest.class);
    } else {
      junit.textui.TestRunner runner = new junit.textui.TestRunner();
      junit.framework.TestResult result =
          runner.run(runner.getTest(OdbcPacketOutputStreamTest.class.getName()));

      System.exit(result.wasSuccessful() ? 0 : 1);
    }
  }
 public static void main(String[] args) {
   try {
     PyImportsHandlingTest test = new PyImportsHandlingTest();
     test.setUp();
     test.testPyImportHandling5();
     test.tearDown();
     junit.textui.TestRunner.run(PyImportsHandlingTest.class);
   } catch (Throwable e) {
     e.printStackTrace();
   }
 }
Beispiel #16
0
 public static void main(String[] args) {
   try {
     CodeFoldingSetterTest test = new CodeFoldingSetterTest();
     test.setUp();
     test.testTryFinally();
     test.tearDown();
     junit.textui.TestRunner.run(CodeFoldingSetterTest.class);
   } catch (Throwable e) {
     e.printStackTrace();
   }
 }
  public static void main(String[] args) {
    TestRunner runner = new TestRunner();
    LargestTest test1 = new LargestTest("testPositiveNumbers");
    LargestTest test2 = new LargestTest("testDuplicateNumbers");

    TestSuite ts = new TestSuite();
    ts.addTest(test1);
    ts.addTest(test2);

    runner.run(ts);
  }
 /**
  * This function allows this test to be run from the command line instead of its usual method,
  * which is through the Daikon MasterTester.
  *
  * @param args arguments to the main function, which control options to the program. As of now
  *     there is only one option, "--generate_goals", which will generate goal information for the
  *     selected tests assuming the output that the tests provide is the correct output
  */
 public static void main(String[] args) {
   daikon.LogHelper.setupLogs(daikon.LogHelper.INFO);
   if (args.length == 1 && args[0].equalsIgnoreCase("--generate_goals")) {
     writeCommandFile();
   } else if (args.length > 0) {
     throw new Daikon.TerminationMessage(
         "Usage: java daikon.test.InvariantAddAndCheckTester" + " [--generate_goals]");
   } else {
     junit.textui.TestRunner.run(new TestSuite(InvariantAddAndCheckTester.class));
   }
 }
 public static void main(String[] args) {
   /*
   X509CertFactoryImplTest test = new X509CertFactoryImplTest();
   long startTime = System.currentTimeMillis();
   for (int i=0; i<10000; i++) {
       test.testEngineGenerateCertificate();
   }
   System.out.println("time: "+(System.currentTimeMillis() - startTime));
   */
   junit.textui.TestRunner.run(suite());
 }
  public static void main(String[] args) {
    try {
      AdditionalInfoIntegrityCheckerTest test = new AdditionalInfoIntegrityCheckerTest();
      test.setUp();
      test.testIntegrityFileHasNoMemory();
      test.tearDown();

      junit.textui.TestRunner.run(AdditionalInfoIntegrityCheckerTest.class);
    } catch (Throwable e) {
      e.printStackTrace();
    }
  }
Beispiel #21
0
 public static void main(String[] args) {
   try {
     PyParser25Test test = new PyParser25Test();
     test.setUp();
     test.testJythonParsing1a();
     test.tearDown();
     System.out.println("Finished");
     junit.textui.TestRunner.run(PyParser25Test.class);
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
Beispiel #22
0
  public static void main(String[] args) throws Throwable {
    TestSuite theSuite;
    if (args.length > 0) {
      theSuite = new TestSuite();
      for (int i = 0; i < args.length; i++) {
        theSuite.addTest(new TestUndirectedModel(args[i]));
      }
    } else {
      theSuite = (TestSuite) suite();
    }

    junit.textui.TestRunner.run(theSuite);
  }
  public static void main(String[] args) {
    try {
      ParsedItemTest analyzer2 = new ParsedItemTest();
      analyzer2.setUp();
      analyzer2.testParsedItemCreation4();
      analyzer2.tearDown();
      System.out.println("finished");

      junit.textui.TestRunner.run(ParsedItemTest.class);
    } catch (Throwable e) {
      e.printStackTrace();
    }
  }
  /** Runs all JSR166 unit tests using junit.textui.TestRunner */
  public static void main(String[] args) {

    int iters = 1;
    if (args.length > 0) iters = Integer.parseInt(args[0]);
    Test s = suite();
    for (int i = 0; i < iters; ++i) {
      junit.textui.TestRunner.run(s);
      System.gc();
      System.runFinalization();
    }

    System.exit(0);
  }
  public static void main(String[] args) {
    try {
      DEBUG_REFERENCES = false;
      RenameModuleRefactoringTest test = new RenameModuleRefactoringTest();
      test.setUp();
      //            test.testRenameModuleInWorkspace3();
      test.tearDown();

      junit.textui.TestRunner.run(RenameModuleRefactoringTest.class);
    } catch (Throwable e) {
      e.printStackTrace();
    }
  }
  public static void main(String[] args) {
    try {
      SearchTest test = new SearchTest();
      test.setUp();
      test.testSearchParameter();
      test.tearDown();

      junit.textui.TestRunner.run(SearchTest.class);

    } catch (Throwable e) {
      e.printStackTrace();
    }
  }
 /**
  * This method allows to easily run this unit test independent of the other unit tests, and
  * without dealing with Ant or unrelated test suites.
  */
 public static void main(String[] sa) {
   junit.textui.TestRunner.run(suite());
   //
   //        if (sa.length > 0 && sa[0].startsWith("-g")) {
   //            junit.swingui.TestRunner.run(DatabaseURLTest.class);
   //        } else {
   //            junit.textui.TestRunner runner = new junit.textui.TestRunner();
   //            junit.framework.TestResult result =
   //                junit.textui.TestRunner.run(runner.getTest(DatabaseURLTest.class.getName()));
   //
   //            System.exit(result.wasSuccessful() ? 0
   //                                               : 1);
   //        }
 }
Beispiel #28
0
  public static void main(String[] args) {
    CompiledModule.COMPILED_MODULES_ENABLED = false;

    try {
      ASTManagerTest test = new ASTManagerTest();
      test.setUp();
      test.testCompletion();
      test.tearDown();

      junit.textui.TestRunner.run(ASTManagerTest.class);
    } catch (Throwable e) {
      e.printStackTrace();
    }
  }
Beispiel #29
0
  public static void main(String[] args) {
    try {
      TabNannyTest analyzer2 = new TabNannyTest();
      analyzer2.setUp();
      analyzer2.testNoInconsistentIndentInStrings();
      analyzer2.tearDown();
      System.out.println("finished");

      junit.textui.TestRunner.run(TabNannyTest.class);
      System.out.println("finished all");
    } catch (Throwable e) {
      e.printStackTrace();
    }
    System.exit(0);
  }
  /** Runs all JSR166 unit tests using junit.textui.TestRunner */
  public static void main(String[] args) {
    if (useSecurityManager) {
      System.err.println("Setting a permissive security manager");
      Policy.setPolicy(permissivePolicy());
      System.setSecurityManager(new SecurityManager());
    }
    int iters = (args.length == 0) ? 1 : Integer.parseInt(args[0]);

    Test s = suite();
    for (int i = 0; i < iters; ++i) {
      junit.textui.TestRunner.run(s);
      System.gc();
      System.runFinalization();
    }
    System.exit(0);
  }