Class TestRunListener
JUnitCore.addTestRunListener(TestRunListener)
or as a contribution to the org.eclipse.jdt.junit.testRunListeners extension point.
The latter approach has the advantage that the contributing plug-in is automatically loaded when a test run starts.
A test run starts with the call to sessionLaunched(ITestRunSession) and
sessionStarted(ITestRunSession), followed by calls to
testCaseStarted(ITestCaseElement) and testCaseFinished(ITestCaseElement)
for all test cases contained in the tree.
A test run session is ended with the call to sessionFinished(ITestRunSession). After that
call, no references must be kept to the session or any of the test cases or suites.
- Since:
- 3.3
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidsessionFinished(ITestRunSession session) A test run session has finished.voidsessionLaunched(ITestRunSession session) A test run session has been launched.voidsessionStarted(ITestRunSession session) A test run session has started.voidtestCaseFinished(ITestCaseElement testCaseElement) A test case has ended.voidtestCaseStarted(ITestCaseElement testCaseElement) A test case has started.
-
Constructor Details
-
TestRunListener
public TestRunListener()
-
-
Method Details
-
sessionLaunched
A test run session has been launched. The test tree is not available yet.Important: The implementor of this method must not keep a reference to the session element after
sessionFinished(ITestRunSession)has finished.- Parameters:
session- the session that has just been launched- Since:
- 3.6
-
sessionStarted
A test run session has started. The test tree can be accessed through the session element.Important: The implementor of this method must not keep a reference to the session element after
sessionFinished(ITestRunSession)has finished.- Parameters:
session- the session that has just started.
-
sessionFinished
A test run session has finished. The test tree can be accessed through the session element.Important: The implementor of this method must not keep the session element when the method is finished.
- Parameters:
session- the test
-
testCaseStarted
A test case has started. The result can be accessed from the element.Important: The implementor of this method must not keep a reference to the test case element after
sessionFinished(ITestRunSession)has finished.- Parameters:
testCaseElement- the test that has started to run
-
testCaseFinished
A test case has ended. The result can be accessed from the element.Important: The implementor of this method must not keep a reference to the test case element after
sessionFinished(ITestRunSession)has finished.- Parameters:
testCaseElement- the test that has finished running
-