Package org.eclipse.jdt.junit
Class JUnitCore
java.lang.Object
org.eclipse.jdt.junit.JUnitCore
Class for accessing JUnit support; all functionality is provided by
static methods.
This class is not intended to be subclassed or instantiated by clients.
- Since:
- 2.1
- Restriction:
- This class is not intended to be subclassed by clients.
- Restriction:
- This class is not intended to be instantiated by clients.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
ID of the JUnit classpath container.static final org.eclipse.core.runtime.IPath
Path of the JUnit 3 classpath container.static final org.eclipse.core.runtime.IPath
Path of the JUnit 4 classpath container.static final org.eclipse.core.runtime.IPath
Path of the JUnit 5 classpath container.static final String
Attribute to control if junit-vintage engine should be used for JUnit 5, defaults to true if not specified. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
addTestRunListener
(ITestRunListener listener) Deprecated.static void
addTestRunListener
(TestRunListener listener) Adds a listener for test runs.static void
exportTestRunSession
(ITestRunSession testRunSession, File file) Exports the given test run session into an XML report file.static void
exportTestRunSession
(ITestRunSession testRunSession, OutputStream output) Exports the given test run session to an output stream.static IType[]
findTestTypes
(IJavaElement container, org.eclipse.core.runtime.IProgressMonitor monitor) Finds types that contain JUnit tests in the given container.static ITestRunSession
importTestRunSession
(File file) Imports a test run session from the given file.static ITestRunSession
importTestRunSession
(String url, org.eclipse.core.runtime.IProgressMonitor monitor) Imports a test run session from the given URL.static void
removeTestRunListener
(ITestRunListener listener) Deprecated.As of 3.3, replaced byremoveTestRunListener(TestRunListener)
static void
removeTestRunListener
(TestRunListener listener) Removes a listener for test runs.
-
Field Details
-
JUNIT_CONTAINER_ID
ID of the JUnit classpath container. The general format of classpath entries using this container is unspecified.- Since:
- 3.6
- See Also:
-
JUNIT3_CONTAINER_PATH
public static final org.eclipse.core.runtime.IPath JUNIT3_CONTAINER_PATHPath of the JUnit 3 classpath container.- Since:
- 3.6
-
JUNIT4_CONTAINER_PATH
public static final org.eclipse.core.runtime.IPath JUNIT4_CONTAINER_PATHPath of the JUnit 4 classpath container.- Since:
- 3.6
-
JUNIT5_CONTAINER_PATH
public static final org.eclipse.core.runtime.IPath JUNIT5_CONTAINER_PATHPath of the JUnit 5 classpath container.- Since:
- 3.10
-
VINTAGE_ATTRIBUTE
Attribute to control if junit-vintage engine should be used for JUnit 5, defaults to true if not specified.- Since:
- 3.13
- See Also:
-
-
Constructor Details
-
JUnitCore
public JUnitCore()
-
-
Method Details
-
addTestRunListener
Deprecated.As of 3.3, replaced byaddTestRunListener(TestRunListener)
Adds a listener for test runs.- Parameters:
listener
- listener to be added
-
removeTestRunListener
Deprecated.As of 3.3, replaced byremoveTestRunListener(TestRunListener)
Removes a listener for test runs.- Parameters:
listener
- listener to be removed
-
addTestRunListener
Adds a listener for test runs.Note: If your plug-in should be loaded when a test run starts, please contribute to the
org.eclipse.jdt.junit.testRunListeners
extension point instead.- Parameters:
listener
- the listener to be added- Since:
- 3.3
-
removeTestRunListener
Removes a listener for test runs.- Parameters:
listener
- the listener to be removed- Since:
- 3.3
-
findTestTypes
public static IType[] findTestTypes(IJavaElement container, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException, org.eclipse.core.runtime.OperationCanceledException Finds types that contain JUnit tests in the given container.- Parameters:
container
- the containermonitor
- the progress monitor used to report progress and request cancelation, ornull
if none- Returns:
- test types inside the given container
- Throws:
org.eclipse.core.runtime.CoreException
- when a problem occurs while accessingcontainer
or its childrenorg.eclipse.core.runtime.OperationCanceledException
- if the operation has been canceled- Since:
- 3.5
-
exportTestRunSession
public static void exportTestRunSession(ITestRunSession testRunSession, File file) throws org.eclipse.core.runtime.CoreException Exports the given test run session into an XML report file.- Parameters:
testRunSession
- the test run sessionfile
- the destination- Throws:
org.eclipse.core.runtime.CoreException
- if an error occurred- Since:
- 3.7
-
exportTestRunSession
public static void exportTestRunSession(ITestRunSession testRunSession, OutputStream output) throws org.eclipse.core.runtime.CoreException Exports the given test run session to an output stream.- Parameters:
testRunSession
- the test run sessionoutput
- the output stream- Throws:
org.eclipse.core.runtime.CoreException
- if an error occurred- Since:
- 3.7
-
importTestRunSession
public static ITestRunSession importTestRunSession(File file) throws org.eclipse.core.runtime.CoreException Imports a test run session from the given file.- Parameters:
file
- a file containing a test run session transcript- Returns:
- the imported test run session
- Throws:
org.eclipse.core.runtime.CoreException
- if the import failed- Since:
- 3.7
-
importTestRunSession
public static ITestRunSession importTestRunSession(String url, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException Imports a test run session from the given URL.- Parameters:
url
- an URL to a test run session transcriptmonitor
- a progress monitor for cancellation- Returns:
- the imported test run session, or
null
if the import has been cancelled - Throws:
org.eclipse.core.runtime.CoreException
- if the import failed- Since:
- 3.7
-
addTestRunListener(TestRunListener)