Skip to main content

This CGIT instance is deprecated, and repositories have been moved to Gitlab or Github. See the repository descriptions for specific locations.

summaryrefslogtreecommitdiffstats
blob: 2115f258459366009e538389849f897115d11a3d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>RSE Test Framework</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="Content-Style-Type" content="text/css" />
    <link rel="stylesheet" type="text/css" href="../book.css" />
</head>
<body>
    <h2>Plugging into the Test Suite View</h2>
    <p>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:</p>
<pre class="code">
&lt;extension point="org.eclipse.rse.tests.framework.suites"&gt;
	&lt;suite ... /&gt;
	&lt;suite ... /&gt;
	&lt;type ... /&gt;
	&lt;suite ... /&gt;
	&lt;type ... /&gt;
&lt;/extension&gt;
</pre>
    <h3>Defining A Test Suite</h3>
    <p>An existing JUnit test suite can be registered as follows:</p>
<pre class="code">
&lt;extension point="org.eclipse.rse.tests.framework.suites"&gt;
	&lt;suite type="standard" name="My Test Suite"&gt;
		&lt;arg name="class" value="com.xyz.MyTestSuite"&gt;
	&lt;/suite&gt;
&lt;/extension&gt;
</pre>
	<p>This defines a test suite that shows up in the view as "My Test Suite". 
	The <code>class</code> argument references a class that ultimately extends 
	<code>junit.framework.TestSuite</code>. 
	The <code>name</code> attribute is optional, but if it isn't specified the framework 
	will ask the suite for its name.</p>
    <h3>Defining A Test Suite Provider</h3>
    <p>If you prefer to dynamically generate test suites based on external criteria, 
    you can implement the <code>org.eclipse.rse.tests.framework.ITestSuiteProvider</code> 
    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 
    <code>ITestSuiteProvider</code> use the <code>suite</code> tag with the <code>generator</code> type.</p>
<pre class="code">
&lt;extension point="org.eclipse.rse.tests.framework.suites"&gt;
	... 
	&lt;suite type="generated" name="BVT Test Suite"&gt; 
		&lt;arg name="class" value="com.xyz.MySuiteProvider"/&gt;
		&lt;arg name="argument" value="bvt"/&gt;
	&lt;/suite&gt; 
	... 
&lt;/extension&gt; 
</pre>
    <p>See the examples and either the javadoc or the source code for ITestSuiteProvider.</p>
    <h3>Using The AnnotatingTestCase Class</h3>
    <p>The class <code>AnnotatingTestCase</code> can be used as a superclass for your tests instead of
    <code>junit.framework.TestCase</code>.  This allows you to use the <code>remark(String)</code>
     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 <code>System.out.println()</code>
     if you want to have extra stuff print for your tests.</p>
    <h3>How Your Test Is Run</h3>
    <p>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 <code>Display#execInUI</code> 
    or <code>Display#syncExecInUI</code> methods. In the future, semi-automatic 
    testing support will provide the ability for testing UI constructs from the test job.</p>
    <h3>Configuration And Prerequisites</h3>
    <p>The Test Suite View is contributed by the plugin 
    <code>org.eclipse.rse.tests.framework</code>.</p>
    <p>Your test suites need only require those plugins that you directly 
    reference -- which would be at least the <code>org.junit</code> plugin. If 
    you implement TestSuiteProvider or use any of the utility classes for annotating 
    the result log you must also require <code>org.eclipse.rse.tests.framework</code>.</p>
    <p>The plugin <code>org.eclipse.rse.tests.framework</code> does not 
    depend on anything other than <code>org.junit</code> and 
    <code>org.eclipse.*</code> plugins.</p>
</body>
</html>

Back to the top