List of usage examples for junit.textui TestRunner run
static public TestResult run(Test test)
From source file:org.apache.jorphan.test.AllTests.java
/** * Starts a run through all unit tests found in the specified classpaths. * The first argument should be a list of paths to search. The second * argument is optional and specifies a properties file used to initialize * logging. The third argument is also optional, and specifies a class that * implements the UnitTestManager interface. This provides a means of * initializing your application with a configuration file prior to the * start of any unit tests.// w w w . j a va 2s.c om * * @param args * the command line arguments */ public static void main(String[] args) { if (args.length < 1) { System.out.println("You must specify a comma-delimited list of paths to search " + "for unit tests"); return; } String home = new File(System.getProperty("user.dir")).getParent(); System.out.println("Setting JMeterHome: " + home); JMeterUtils.setJMeterHome(home); initializeLogging(args); initializeManager(args); String version = "JMeterVersion=" + JMeterUtils.getJMeterVersion(); log.info(version); System.out.println(version); logprop("java.version", true); logprop("java.vm.name"); logprop("java.vendor"); logprop("java.home", true); logprop("file.encoding", true); // Display actual encoding used (will differ if file.encoding is not recognised) String msg = "default encoding=" + Charset.defaultCharset(); System.out.println(msg); log.info(msg); logprop("user.home"); logprop("user.dir", true); logprop("user.language"); logprop("user.region"); logprop("user.country"); logprop("user.variant"); final String showLocale = "Locale=" + Locale.getDefault().toString(); log.info(showLocale); System.out.println(showLocale); logprop("os.name", true); logprop("os.version", true); logprop("os.arch"); logprop("java.class.version"); // logprop("java.class.path"); String cp = System.getProperty("java.class.path"); String cpe[] = JOrphanUtils.split(cp, java.io.File.pathSeparator); StringBuilder sb = new StringBuilder(3000); sb.append("java.class.path="); for (int i = 0; i < cpe.length; i++) { sb.append("\n"); sb.append(cpe[i]); if (new java.io.File(cpe[i]).exists()) { sb.append(" - OK"); } else { sb.append(" - ??"); } } log.info(sb.toString()); // ++ // GUI tests throw the error // testArgumentCreation(org.apache.jmeter.config.gui.ArgumentsPanel$Test)java.lang.NoClassDefFoundError // at java.lang.Class.forName0(Native Method) // at java.lang.Class.forName(Class.java:141) // at // java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:62) // // Try to find out why this is ... System.out.println("+++++++++++"); logprop("java.awt.headless", true); logprop("java.awt.graphicsenv", true); // // try {// // Class c = Class.forName(n); // System.out.println("Found class: "+n); // // c.newInstance(); // // System.out.println("Instantiated: "+n); // } catch (Exception e1) { // System.out.println("Error finding class "+n+" "+e1); // } catch (java.lang.InternalError e1){ // System.out.println("Error finding class "+n+" "+e1); // } // System.out.println("------------"); // don't call isHeadless() here, as it has a side effect. // -- System.out.println("Creating test suite"); TestSuite suite = suite(args[0]); int countTestCases = suite.countTestCases(); System.out.println("Starting test run, test count = " + countTestCases); // for (int i=0;i<suite.testCount();i++){ // Test testAt = suite.testAt(i); // int testCases = testAt.countTestCases(); // if (testAt instanceof junit.framework.TestCase){ // System.out.print(((junit.framework.TestCase) testAt).getName()); // } // if (testAt instanceof TestSuite){ // TestSuite testSuite = ((TestSuite) testAt); // String name = testSuite.getName(); // System.out.print(name); // System.out.println(" "+testCases); // } // } // Jeremy Arnold: This method used to attempt to write results to // a file, but it had a bug and instead just wrote to System.out. // Since nobody has complained about this behavior, I'm changing // the code to not attempt to write to a file, so it will continue // behaving as it did before. It would be simple to make it write // to a file instead if that is the desired behavior. TestResult result = TestRunner.run(suite); // ++ // Recheck settings: //System.out.println("+++++++++++"); // System.out.println(e+"="+System.getProperty(e)); // System.out.println(g+"="+System.getProperty(g)); // System.out.println("Headless? // "+java.awt.GraphicsEnvironment.isHeadless()); // try { // Class c = Class.forName(n); // System.out.println("Found class: "+n); // c.newInstance(); // System.out.println("Instantiated: "+n); // } catch (Exception e1) { // System.out.println("Error with class "+n+" "+e1); // } catch (java.lang.InternalError e1){ // System.out.println("Error with class "+n+" "+e1); // } //System.out.println("------------"); // -- System.exit(result.wasSuccessful() ? 0 : 1); // this is needed because the test may start the AWT EventQueue thread which is not a daemon. }
From source file:org.apache.openjpa.persistence.xmlmapping.query.TestXMLCustomerOrder.java
public static void main(String[] args) { TestRunner.run(TestXMLCustomerOrder.class); }
From source file:org.apache.roller.weblogger.business.PlanetManagerLocalTest.java
public static void main(String[] args) { TestRunner.run(PlanetManagerLocalTest.class); }
From source file:org.bresearch.websec.test.CommonsMathTest.java
public static void main(String args[]) { TestSuite suite = new TestSuite(); suite.addTestSuite(CommonsMathTest.class); TestRunner.run(suite); return;// w w w . j a v a 2 s . c o m }
From source file:org.eclipse.mylyn.reviews.r4e.core.model.tests.R4EReviewGroupTest.java
/** * <!-- begin-user-doc --> <!-- end-user-doc --> * /*www .ja v a 2 s .c o m*/ * @generated */ public static void main(String[] args) { TestRunner.run(R4EReviewGroupTest.class); }
From source file:org.enerj.apache.commons.collections.TestClosureUtils.java
/** * Main. * @param args */ public static void main(String[] args) { TestRunner.run(suite()); }
From source file:org.geotools.coverage.io.netcdf.NetCDFMosaicReaderTest.java
/** * @param args */ public static void main(String[] args) { TestRunner.run(NetCDFMosaicReaderTest.suite()); }
From source file:org.geotools.gce.imagemosaic.ImageMosaicReaderTest.java
/** * @param args */ public static void main(String[] args) { TestRunner.run(ImageMosaicReaderTest.suite()); }
From source file:org.geotools.gce.imagemosaic.OverviewsControllerTest.java
/** * @param args */ public static void main(String[] args) { TestRunner.run(OverviewsControllerTest.suite()); }
From source file:org.nuxeo.ecm.core.repository.jcr.lock.RepositorySessionLockStress.java
public static void main(String[] args) { int documentCount = Integer.parseInt(args[0]); boolean isThreadsSafe = Boolean.parseBoolean(args[1]); boolean isOperationDelayed = Boolean.parseBoolean(args[2]); int numberOfThreads = Integer.parseInt(args[3]); int numbersOfOperation = Integer.parseInt(args[4]); TestCase test = new RepositorySessionLockStress(documentCount, isThreadsSafe, isOperationDelayed, numberOfThreads, numbersOfOperation); TestRunner.run(test); }