com.sun.javatest
Class TestRunner

java.lang.Object
  extended by com.sun.javatest.TestRunner
Direct Known Subclasses:
DefaultTestRunner

public abstract class TestRunner
extends java.lang.Object

TestRunner is the abstract base class providing the ability to control how tests are run. A default is provided that executes each test by means of a script class.

If a test suite does not wish tom use the default test runner, it should provide its own implementation of this class. The primary method which should be implemented is runTests(java.util.Iterator).


Constructor Summary
TestRunner()
           
 
Method Summary
 BackupPolicy getBackupPolicy()
          Get the backup policy to be used when creating the test result files generated by this test runner.
 int getConcurrency()
          Get the concurrency to be used when running the tests, if applicable.
 TestEnvironment getEnvironment()
          Get the test environment to be used to execute the tests that will be run by this test runner.
 java.lang.String[] getExcludedTestCases(TestDescription td)
          Get the names of the test cases to be excluded when running a specific test.
 ExcludeList getExcludeList()
          Get the exclude list to be used to identify the test cases to be excluded when running tests.
 TestSuite getTestSuite()
          Get the test suite containing the tests to be run by this test runner.
 WorkDirectory getWorkDirectory()
          Get the work directory to be used to store the test results generated by this test runner.
protected  void notifyFinishedTest(TestResult tr)
          This method must be called when each test is finished, to notify any registered observers.
protected  void notifyStartingTest(TestResult tr)
          This method must be called as each test is started, to notify any registered observers.
protected abstract  boolean runTests(java.util.Iterator testIter)
          Run the tests obtained from an iterator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TestRunner

public TestRunner()
Method Detail

getWorkDirectory

public WorkDirectory getWorkDirectory()
Get the work directory to be used to store the test results generated by this test runner.

Returns:
the work directory used to store the test results generated by this test runner

getTestSuite

public TestSuite getTestSuite()
Get the test suite containing the tests to be run by this test runner.

Returns:
the test suite containing the tests to be run by this test runner

getBackupPolicy

public BackupPolicy getBackupPolicy()
Get the backup policy to be used when creating the test result files generated by this test runner.

Returns:
the backup policy to be used when creating the test result files generated by this test runner
See Also:
TestResult.writeResults(WorkDirectory, BackupPolicy)

getEnvironment

public TestEnvironment getEnvironment()
Get the test environment to be used to execute the tests that will be run by this test runner.

Returns:
the test environment to be used to execute the tests that will be run by this test runner
See Also:
getEnvironment()

getExcludeList

public ExcludeList getExcludeList()
Get the exclude list to be used to identify the test cases to be excluded when running tests.

Returns:
the exclude list to be used to identify the test cases to be excluded when running tests
See Also:
getExcludedTestCases(com.sun.javatest.TestDescription)

getExcludedTestCases

public java.lang.String[] getExcludedTestCases(TestDescription td)
Get the names of the test cases to be excluded when running a specific test.

Parameters:
td - the test for which the excluded test cases should be obtained
Returns:
the names of the test cases to be excluded when running a specific test. The result is null if the test is not found or is completely excluded without specifying test cases. This may be a mix of single TC strings or a comma separated list of them.

getConcurrency

public int getConcurrency()
Get the concurrency to be used when running the tests, if applicable.

Returns:
the concurrency to be used when running the tests, if applicable
See Also:
getConcurrency()

runTests

protected abstract boolean runTests(java.util.Iterator testIter)
                             throws java.lang.InterruptedException
Run the tests obtained from an iterator. The iterator returns TestDescription objects for the tests that have been selected to be run. The iterator supports the standard hasNext() and next() methods; it does not support remove(), which throws UnsupportedOperationException. Each test description gives the details of the test to be run. As each test is started, the implementation of this method must create a new TestResult object and call notifyStartingTest(com.sun.javatest.TestResult). When the test completes (however it completes) the implementation of this method must call notifyFinishedTest(com.sun.javatest.TestResult).

Parameters:
testIter - the iterator to be used to obtain the tests to be run
Returns:
true if and only if all the tests executed successfully and passed
Throws:
java.lang.InterruptedException - if the test run was interrupted

notifyStartingTest

protected void notifyStartingTest(TestResult tr)
This method must be called as each test is started, to notify any registered observers.

Parameters:
tr - the TestResult object for the test that has been started
See Also:
Harness.Observer

notifyFinishedTest

protected void notifyFinishedTest(TestResult tr)
This method must be called when each test is finished, to notify any registered observers.

Parameters:
tr - the TestResult object for the test that has been started
See Also:
Harness.Observer


Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.