Class FrameworkController
FrameworkController provides a facade for use in loading, browsing and running tests without requiring a reference to the NUnit framework. All calls are encapsulated in constructors for this class and its nested classes, which only require the types of the Common Type System as arguments.
The controller supports four actions: Load, Explore, Count and Run. They are intended to be called by a driver, which should allow for proper sequencing of calls. Load must be called before any of the other actions. The driver may support other actions, such as reload on run, by combining these calls.
public class FrameworkController : LongLivedMarshalByRefObject
- Inheritance
-
FrameworkController
- Inherited Members
Constructors
FrameworkController(Assembly, string, IDictionary)
Construct a FrameworkController using the default builder and runner.
public FrameworkController(Assembly assembly, string idPrefix, IDictionary settings)
Parameters
assembly
AssemblyThe test assembly
idPrefix
stringA prefix used for all test ids created under this controller.
settings
IDictionaryA Dictionary of settings to use in loading and running the tests
FrameworkController(Assembly, string, IDictionary, string, string)
Construct a FrameworkController, specifying the types to be used for the runner and builder. This constructor is provided for purposes of development.
public FrameworkController(Assembly assembly, string idPrefix, IDictionary settings, string runnerType, string builderType)
Parameters
assembly
AssemblyThe test assembly
idPrefix
stringA prefix used for all test ids created under this controller.
settings
IDictionaryA Dictionary of settings to use in loading and running the tests
runnerType
stringThe Type of the test runner
builderType
stringThe Type of the test builder
FrameworkController(string, string?, IDictionary)
Construct a FrameworkController using the default builder and runner.
public FrameworkController(string assemblyNameOrPath, string? idPrefix, IDictionary settings)
Parameters
assemblyNameOrPath
stringThe AssemblyName or path to the test assembly
idPrefix
stringA prefix used for all test ids created under this controller.
settings
IDictionaryA Dictionary of settings to use in loading and running the tests
FrameworkController(string, string?, IDictionary, string, string)
Construct a FrameworkController, specifying the types to be used for the runner and builder. This constructor is provided for purposes of development.
public FrameworkController(string assemblyNameOrPath, string? idPrefix, IDictionary settings, string runnerType, string builderType)
Parameters
assemblyNameOrPath
stringThe full AssemblyName or the path to the test assembly
idPrefix
stringA prefix used for all test ids created under this controller.
settings
IDictionaryA Dictionary of settings to use in loading and running the tests
runnerType
stringThe Type of the test runner
builderType
stringThe Type of the test builder
Properties
AssemblyNameOrPath
Gets the AssemblyName or the path for which this FrameworkController was created
public string AssemblyNameOrPath { get; }
Property Value
Builder
Gets the ITestAssemblyBuilder used by this controller instance.
public ITestAssemblyBuilder Builder { get; }
Property Value
- ITestAssemblyBuilder
The builder.
Runner
Gets the ITestAssemblyRunner used by this controller instance.
public ITestAssemblyRunner Runner { get; }
Property Value
- ITestAssemblyRunner
The runner.
Methods
CountTests(string?)
Counts the number of test cases in the loaded TestSuite
public int CountTests(string? filter)
Parameters
filter
stringA string containing the XML representation of the filter to use
Returns
- int
The number of tests
ExploreTests(string?)
Returns info about the tests in an assembly
public string ExploreTests(string? filter)
Parameters
filter
stringA string containing the XML representation of the filter to use
Returns
- string
The XML result of exploring the tests
InsertEnvironmentElement(TNode)
Inserts environment element
public static TNode InsertEnvironmentElement(TNode targetNode)
Parameters
targetNode
TNodeTarget node
Returns
- TNode
The new node
InsertSettingsElement(TNode, IDictionary<string, object>)
Inserts settings element
public static TNode InsertSettingsElement(TNode targetNode, IDictionary<string, object> settings)
Parameters
targetNode
TNodeTarget node
settings
IDictionary<string, object>Settings dictionary
Returns
- TNode
The new node
LoadTests()
Loads the tests in the assembly
public string LoadTests()
Returns
RunTests(Action<string>, string)
Runs the tests in an assembly synchronously reporting back the test results through the callback or through the return value
public string RunTests(Action<string> callback, string filter)
Parameters
callback
Action<string>The callback that receives the test results
filter
stringA string containing the XML representation of the filter to use
Returns
- string
The XML result of the test run
RunTests(string?)
Runs the tests in an assembly
public string RunTests(string? filter)
Parameters
filter
stringA string containing the XML representation of the filter to use
Returns
- string
The XML result of the test run
StopRun(bool)
Stops the test run
public void StopRun(bool force)
Parameters
force
boolTrue to force the stop, false for a cooperative stop