Methods Summary |
---|
public junit.framework.TestResult | doRun(junit.framework.Test suite, boolean wait)
StatsStore.open(jdbcDriver, connectionURL);
TestResult result = new TestResult();
result.addListener(fPrinter);
result.addListener(fPerfStatCollector);
long startTime= System.currentTimeMillis();
StatsStore.now = startTime;
suite.run(result);
long endTime= System.currentTimeMillis();
long runTime= endTime-startTime;
fPrinter.print(result, runTime);
fPerfStatCollector.digest();
StatsStore.close();
pause(wait);
return result;
|
public junit.runner.TestSuiteLoader | getLoader()Always use the StandardTestSuiteLoader. Overridden from
BaseTestRunner.
return new StandardTestSuiteLoader();
|
public static void | main(java.lang.String[] args)
StatTestRunner aTestRunner= new StatTestRunner();
try {
TestResult r= aTestRunner.start(args);
if (!r.wasSuccessful())
System.exit(FAILURE_EXIT);
System.exit(SUCCESS_EXIT);
} catch(Exception e) {
System.err.println(e.getMessage());
System.exit(EXCEPTION_EXIT);
}
|
protected void | pause(boolean wait)
if (!wait) return;
fPrinter.printWaitPrompt();
try {
System.in.read();
}
catch(Exception e) {
}
|
public static void | run(java.lang.Class testClass)Runs a suite extracted from a TestCase subclass.
run(new TestSuite(testClass));
|
public static junit.framework.TestResult | run(junit.framework.Test test)Runs a single test and collects its results.
This method can be used to start a test run
from your program.
public static void main (String[] args) {
test.textui.TestRunner.run(suite());
}
StatTestRunner runner= new StatTestRunner();
try {
return runner.doRun(test, false);
}
catch (Exception e) {
return null;
}
|
public static void | runAndWait(junit.framework.Test suite)Runs a single test and waits until the user
types RETURN.
StatTestRunner aTestRunner= new StatTestRunner();
try {
aTestRunner.doRun(suite, true);
}
catch (Exception e) {}
|
protected void | runFailed(java.lang.String message)
System.err.println(message);
System.exit(FAILURE_EXIT);
|
public void | setPrinter(ResultPrinter printer)
fPrinter= printer;
|
protected junit.framework.TestResult | start(java.lang.String[] args)Starts a test run. Analyzes the command line arguments
and runs the given test suite.
String testCase= "";
boolean wait= false;
jdbcDriver = System.getProperty("android.coretests.driver", DEFAULT_DRIVER);
connectionURL = System.getProperty("android.coretests.database", "jdbc:" + DEFAULT_DATABASE);
for (int i= 0; i < args.length; i++) {
if (args[i].equals("--all"))
fPerfStatCollector.listAll = true;
else if (args[i].equals("--bad"))
fPerfStatCollector.listBad = true;
else if (args[i].equals("--nobig"))
fPerfStatCollector.bigMarking = false;
else if (args[i].equals("--s")) {
fPerfStatCollector.thresholdDuration =
Integer.valueOf(args[++i]);
} else if (args[i].equals("-wait"))
wait= true;
else if (args[i].equals("-c"))
testCase= extractClassName(args[++i]);
else if (args[i].equals("-v"))
System.err.println("JUnit "+Version.id()+" (plus Android performance stats)");
else
testCase= args[i];
}
if (testCase.equals(""))
throw new Exception("Usage: TestRunner [-wait] testCaseName, where name is the name of the TestCase class");
try {
Test suite= getTest(testCase);
return doRun(suite, wait);
}
catch (Exception e) {
throw new Exception("Exception: " + e);
}
|
public void | testEnded(java.lang.String testName)
|
public void | testFailed(int status, junit.framework.Test test, java.lang.Throwable t)
|
public void | testStarted(java.lang.String testName)
|