The Test Suite View shows test cases that have registered with the plugin. This section describes how this is done. The tags provide for both static declaration and dynamic generation of test suites. You can define several suites and suite providers in a single extension as follows:
<extension point="org.eclipse.rse.tests.framework.suites"> <suite ... /> <suite ... /> <type ... /> <suite ... /> <type ... /> </extension>
An existing JUnit test suite can be registered as follows:
<extension point="org.eclipse.rse.tests.framework.suites"> <suite type="standard" name="My Test Suite"> <arg name="class" value="com.xyz.MyTestSuite"> </suite> </extension>
This defines a test suite that shows up in the view as "My Test Suite".
The class
argument references a class that ultimately extends
junit.framework.TestSuite
.
The name
attribute is optional, but if it isn't specified the framework
will ask the suite for its name.
If you prefer to dynamically generate test suites based on external criteria,
you can implement the org.eclipse.rse.tests.framework.ITestSuiteProvider
interface.
This allows you to programatically assemble a test suite from individual
testcases based on whatever criteria present in the workbench that you wish to use,
including an argument provided on the registration. To register your
ITestSuiteProvider
use the suite
tag with the generator
type.
<extension point="org.eclipse.rse.tests.framework.suites"> ... <suite type="generated" name="BVT Test Suite"> <arg name="class" value="com.xyz.MySuiteProvider"/> <arg name="argument" value="bvt"/> </suite> ... </extension>
See the examples and either the javadoc or the source code for ITestSuiteProvider.
The class AnnotatingTestCase
can be used as a superclass for your tests instead of
junit.framework.TestCase
. This allows you to use the remark(String)
method in your testcases to cause a line to be printed in the results pane before the final status of
the tests. It's a reasonable replacement for System.out.println()
if you want to have extra stuff print for your tests.
You test suite will run inside of a eclipse user job.
This means you don't have direct access to the UI thread or
any of its resources at this time unless you use the SWT Display#execInUI
or Display#syncExecInUI
methods. In the future, semi-automatic
testing support will provide the ability for testing UI constructs from the test job.
The Test Suite View is contributed by the plugin
org.eclipse.rse.tests.framework
.
Your test suites need only require those plugins that you directly
reference -- which would be at least the org.junit
plugin. If
you implement TestSuiteProvider or use any of the utility classes for annotating
the result log you must also require org.eclipse.rse.tests.framework
.
The plugin org.eclipse.rse.tests.framework
does not
depend on anything other than org.junit
and
org.eclipse.*
plugins.