~adam-rpconnelly/nunit-3.0/bug-487878

« back to all changes in this revision

Viewing changes to src/framework/Api/TestRunner.cs

  • Committer: Charlie Poole
  • Date: 2009-12-29 17:47:14 UTC
  • Revision ID: charlie@nunit.com-20091229174714-tp1rjzat2zexjkbm
Remove unused classes

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// ***********************************************************************
2
 
// Copyright (c) 2007 Charlie Poole
3
 
//
4
 
// Permission is hereby granted, free of charge, to any person obtaining
5
 
// a copy of this software and associated documentation files (the
6
 
// "Software"), to deal in the Software without restriction, including
7
 
// without limitation the rights to use, copy, modify, merge, publish,
8
 
// distribute, sublicense, and/or sell copies of the Software, and to
9
 
// permit persons to whom the Software is furnished to do so, subject to
10
 
// the following conditions:
11
 
// 
12
 
// The above copyright notice and this permission notice shall be
13
 
// included in all copies or substantial portions of the Software.
14
 
// 
15
 
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
 
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
 
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
 
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
 
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
 
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
 
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
 
// ***********************************************************************
23
 
 
24
 
using System;
25
 
using System.Collections;
26
 
using System.IO;
27
 
 
28
 
namespace NUnit.Core
29
 
{
30
 
        /// <summary>
31
 
        /// The TestRunner Interface allows client code, such as the NUnit console and
32
 
        /// gui runners, to load and run tests. This is the lowest level interface generally
33
 
        /// supported for running tests and is implemented by the RemoteTestRunner class in
34
 
        /// the NUnit core as well as by other classes running on the client side.
35
 
        /// 
36
 
        /// The Load method is used to load a suite of tests from one or more 
37
 
        /// assemblies, returning a tree of TestNodes to the caller.
38
 
        /// 
39
 
        /// The CountTestCases family of methods returns the number of test cases in the
40
 
        /// loaded suite, either in its entirety or by using a filter to count a subset of tests.
41
 
        /// 
42
 
        /// The Run family of methods performs a test run synchronously, returning a TestResult
43
 
        /// or TestResult[] to the caller. If provided, an EventListener interface will be 
44
 
        /// notified of significant events in the running of the tests. A filter may be used
45
 
    /// to run a subset of the tests.
46
 
    ///
47
 
    /// BeginRun and EndRun provide a simplified form of the asynchronous invocation
48
 
        /// pattern used in many places within the .NET framework. Because the current
49
 
        /// implementation allows only one run to be in process at a time, an IAsyncResult
50
 
        /// is not used at this time.
51
 
    /// 
52
 
    /// Methods to cancel a run and to wait for a run to complete are also provided. The 
53
 
    /// result of the last run may be obtained by querying the TestResult property.
54
 
    /// 
55
 
    /// </summary>
56
 
        public interface TestRunner
57
 
        {
58
 
                #region Properties
59
 
                /// <summary>
60
 
                /// TestRunners are identified by an ID. So long as there
61
 
                /// is only one test runner or a single chain of test runners,
62
 
                /// the default id of 0 may be used. However, any client that
63
 
                /// creates multiple runners must ensure that each one has a
64
 
                /// unique ID in order to locate and run specific tests.
65
 
                /// </summary>
66
 
                int ID
67
 
                {
68
 
                        get;
69
 
                }
70
 
 
71
 
                /// <summary>
72
 
                /// IsTestRunning indicates whether a test is in progress. To retrieve the
73
 
                /// results from an asynchronous test run, wait till IsTestRunning is false.
74
 
                /// </summary>
75
 
                bool Running
76
 
                {
77
 
                        get;
78
 
                }
79
 
 
80
 
                /// <summary>
81
 
                /// Returns information about loaded assemblies
82
 
                /// </summary>
83
 
                TestAssemblyInfo[] AssemblyInfo
84
 
                {
85
 
                        get;
86
 
                }
87
 
 
88
 
                /// <summary>
89
 
                /// The loaded test, converted to a tree of TestNodes so they can be
90
 
                /// serialized and marshalled to a remote client.
91
 
                /// </summary>
92
 
                ITest Test
93
 
                {
94
 
                        get;
95
 
                }
96
 
 
97
 
                /// <summary>
98
 
                /// Result of the last test run.
99
 
                /// </summary>
100
 
                TestResult TestResult
101
 
                {
102
 
                        get;
103
 
                }
104
 
                #endregion
105
 
 
106
 
                #region Load and Unload Methods
107
 
                /// <summary>
108
 
                /// Load the assemblies in a test package
109
 
                /// </summary>
110
 
                /// <param name="package">The test package to be loaded</param>
111
 
                /// <returns>True if the tests were loaded successfully, otherwise false</returns>
112
 
                bool Load( TestPackage package );
113
 
 
114
 
                /// <summary>
115
 
                /// Unload all tests previously loaded
116
 
                /// </summary>
117
 
                void Unload();
118
 
                #endregion
119
 
 
120
 
                #region CountTestCases Methods
121
 
                /// <summary>
122
 
                /// Count Test Cases using a filter
123
 
                /// </summary>
124
 
                /// <param name="filter">The filter to apply</param>
125
 
                /// <returns>The number of test cases found</returns>
126
 
                int CountTestCases(TestFilter filter );
127
 
                #endregion
128
 
 
129
 
                #region Run Methods
130
 
                /// <summary>
131
 
                /// Run all loaded tests and return a test result. The test is run synchronously,
132
 
                /// and the listener interface is notified as it progresses.
133
 
                /// </summary>
134
 
                /// <param name="listener">Interface to receive EventListener notifications.</param>
135
 
                TestResult Run(ITestListener listener);
136
 
 
137
 
                /// <summary>
138
 
                /// Run selected tests and return a test result. The test is run synchronously,
139
 
                /// and the listener interface is notified as it progresses.
140
 
                /// </summary>
141
 
                /// <param name="listener">Interface to receive EventListener notifications.</param>
142
 
                /// <param name="filter">The filter to apply when running the tests</param>
143
 
                TestResult Run(ITestListener listener, TestFilter filter);
144
 
                
145
 
                /// <summary>
146
 
                /// Start a run of all loaded tests. The tests are run aynchronously and the 
147
 
                /// listener interface is notified as it progresses.
148
 
                /// </summary>
149
 
                /// <param name="listener">Interface to receive EventListener notifications.</param>
150
 
                void BeginRun(ITestListener listener);
151
 
 
152
 
                /// <summary>
153
 
                /// Start a run of selected tests. The tests are run aynchronously and the 
154
 
                /// listener interface is notified as it progresses.
155
 
                /// </summary>
156
 
                /// <param name="listener">Interface to receive EventListener notifications.</param>
157
 
                /// <param name="filter">The filter to apply when running the tests</param>
158
 
                void BeginRun(ITestListener listener, TestFilter filter);
159
 
                
160
 
                /// <summary>
161
 
                /// Wait for an asynchronous run to complete and return the result.
162
 
                /// </summary>
163
 
                /// <returns>A TestResult for the entire run</returns>
164
 
                TestResult EndRun();
165
 
 
166
 
                /// <summary>
167
 
                ///  Cancel the test run that is in progress. For a synchronous run,
168
 
                ///  a client wanting to call this must create a separate run thread.
169
 
                /// </summary>
170
 
                void CancelRun();
171
 
 
172
 
                /// <summary>
173
 
                /// Wait for the test run in progress to complete. For a synchronous run,
174
 
                /// a client wanting to call this must create a separate run thread. In
175
 
                /// particular, a gui client calling this method is likely to hang, since
176
 
                /// events will not be able to invoke methods on the gui thread.
177
 
                /// </summary>
178
 
                void Wait();
179
 
                #endregion
180
 
        }
181
 
}
182