KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > junit > TestRunListener


1 /*******************************************************************************
2  * Copyright (c) 2000, 2007 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.jdt.junit;
12
13 import org.eclipse.jdt.junit.model.ITestCaseElement;
14 import org.eclipse.jdt.junit.model.ITestRunSession;
15
16 /**
17  * A test run listener that can be registered at {@link JUnitCore#addTestRunListener(TestRunListener)}.
18  * <p>
19  * A test run starts with the call to {@link #sessionStarted(ITestRunSession)} followed by calls to
20  * {@link #testCaseStarted(ITestCaseElement)} and {@link #testCaseFinished(ITestCaseElement)}
21  * for all test cases contained in the tree.
22  * </p>
23  * <p>
24  * A test run session is ended with the call to {@link #sessionFinished(ITestRunSession)}. After that
25  * call, no references must be kept to the session or any of the test cases or suites.
26  * </p>
27  *
28  * @since 3.3
29  */

30 public abstract class TestRunListener {
31     
32     /**
33      * A test run session has started. The test tree can be accessed through the session element.
34      * <p>
35      * Important: The implementor of this method must not keep a reference to the session element longer
36      * after {@link #sessionFinished(ITestRunSession)} has finished.
37      * </p>
38      *
39      * @param session the session that has just started.
40      */

41     public void sessionStarted(ITestRunSession session) {
42     }
43     
44     /**
45      * A test run session has finished. The test tree can be accessed through the session element.
46      *
47      * <p>
48      * Important: The implementor of this method must not keep the session element when the method is finished.
49      * </p>
50      *
51      * @param session the test
52      */

53     public void sessionFinished(ITestRunSession session) {
54     }
55         
56     /**
57      * A test case has started. The result can be accessed from the element.
58      * <p>
59      * Important: The implementor of this method must not keep a reference to the test case element
60      * after {@link #sessionFinished(ITestRunSession)} has finished.
61      * </p>
62      * @param testCaseElement the test that has started to run
63      */

64     public void testCaseStarted(ITestCaseElement testCaseElement) {
65     }
66     
67     /**
68      * A test case has ended. The result can be accessed from the element.
69      * <p>
70      * Important: The implementor of this method must not keep a reference to the test case element
71      * after {@link #sessionFinished(ITestRunSession)} has finished.
72      * </p>
73      *
74      * @param testCaseElement the test that has finished running
75      */

76     public void testCaseFinished(ITestCaseElement testCaseElement) {
77     }
78 }
79
Popular Tags