Search Results for

    Show / Hide Table of Contents

    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.

    Inheritance
    object
    MarshalByRefObject
    LongLivedMarshalByRefObject
    FrameworkController
    Inherited Members
    LongLivedMarshalByRefObject.InitializeLifetimeService()
    MarshalByRefObject.GetLifetimeService()
    MarshalByRefObject.MemberwiseClone(bool)
    object.GetType()
    object.MemberwiseClone()
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    Namespace: NUnit.Framework.Api
    Assembly: nunit.framework.dll
    Syntax
    public class FrameworkController : LongLivedMarshalByRefObject

    Constructors

    View Source

    FrameworkController(Assembly, string, IDictionary)

    Construct a FrameworkController using the default builder and runner.

    Declaration
    public FrameworkController(Assembly assembly, string idPrefix, IDictionary settings)
    Parameters
    Type Name Description
    Assembly assembly

    The test assembly

    string idPrefix

    A prefix used for all test ids created under this controller.

    IDictionary settings

    A Dictionary of settings to use in loading and running the tests

    View Source

    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.

    Declaration
    public FrameworkController(Assembly assembly, string idPrefix, IDictionary settings, string runnerType, string builderType)
    Parameters
    Type Name Description
    Assembly assembly

    The test assembly

    string idPrefix

    A prefix used for all test ids created under this controller.

    IDictionary settings

    A Dictionary of settings to use in loading and running the tests

    string runnerType

    The Type of the test runner

    string builderType

    The Type of the test builder

    View Source

    FrameworkController(string, string?, IDictionary)

    Construct a FrameworkController using the default builder and runner.

    Declaration
    public FrameworkController(string assemblyNameOrPath, string? idPrefix, IDictionary settings)
    Parameters
    Type Name Description
    string assemblyNameOrPath

    The AssemblyName or path to the test assembly

    string idPrefix

    A prefix used for all test ids created under this controller.

    IDictionary settings

    A Dictionary of settings to use in loading and running the tests

    View Source

    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.

    Declaration
    public FrameworkController(string assemblyNameOrPath, string? idPrefix, IDictionary settings, string runnerType, string builderType)
    Parameters
    Type Name Description
    string assemblyNameOrPath

    The full AssemblyName or the path to the test assembly

    string idPrefix

    A prefix used for all test ids created under this controller.

    IDictionary settings

    A Dictionary of settings to use in loading and running the tests

    string runnerType

    The Type of the test runner

    string builderType

    The Type of the test builder

    Properties

    View Source

    AssemblyNameOrPath

    Gets the AssemblyName or the path for which this FrameworkController was created

    Declaration
    public string AssemblyNameOrPath { get; }
    Property Value
    Type Description
    string
    View Source

    Builder

    Gets the ITestAssemblyBuilder used by this controller instance.

    Declaration
    public ITestAssemblyBuilder Builder { get; }
    Property Value
    Type Description
    ITestAssemblyBuilder

    The builder.

    View Source

    Runner

    Gets the ITestAssemblyRunner used by this controller instance.

    Declaration
    public ITestAssemblyRunner Runner { get; }
    Property Value
    Type Description
    ITestAssemblyRunner

    The runner.

    Methods

    View Source

    CountTests(string?)

    Counts the number of test cases in the loaded TestSuite

    Declaration
    public int CountTests(string? filter)
    Parameters
    Type Name Description
    string filter

    A string containing the XML representation of the filter to use

    Returns
    Type Description
    int

    The number of tests

    View Source

    ExploreTests(string?)

    Returns info about the tests in an assembly

    Declaration
    public string ExploreTests(string? filter)
    Parameters
    Type Name Description
    string filter

    A string containing the XML representation of the filter to use

    Returns
    Type Description
    string

    The XML result of exploring the tests

    View Source

    InsertEnvironmentElement(TNode)

    Inserts environment element

    Declaration
    public static TNode InsertEnvironmentElement(TNode targetNode)
    Parameters
    Type Name Description
    TNode targetNode

    Target node

    Returns
    Type Description
    TNode

    The new node

    View Source

    InsertSettingsElement(TNode, IDictionary<string, object>)

    Inserts settings element

    Declaration
    public static TNode InsertSettingsElement(TNode targetNode, IDictionary<string, object> settings)
    Parameters
    Type Name Description
    TNode targetNode

    Target node

    IDictionary<string, object> settings

    Settings dictionary

    Returns
    Type Description
    TNode

    The new node

    View Source

    LoadTests()

    Loads the tests in the assembly

    Declaration
    public string LoadTests()
    Returns
    Type Description
    string
    View Source

    RunTests(Action<string>, string)

    Runs the tests in an assembly synchronously reporting back the test results through the callback or through the return value

    Declaration
    public string RunTests(Action<string> callback, string filter)
    Parameters
    Type Name Description
    Action<string> callback

    The callback that receives the test results

    string filter

    A string containing the XML representation of the filter to use

    Returns
    Type Description
    string

    The XML result of the test run

    View Source

    RunTests(string?)

    Runs the tests in an assembly

    Declaration
    public string RunTests(string? filter)
    Parameters
    Type Name Description
    string filter

    A string containing the XML representation of the filter to use

    Returns
    Type Description
    string

    The XML result of the test run

    View Source

    StopRun(bool)

    Stops the test run

    Declaration
    public void StopRun(bool force)
    Parameters
    Type Name Description
    bool force

    True to force the stop, false for a cooperative stop

    • View Source
    In this article
    Back to top Generated by DocFX | Copyright (c) 2018- The NUnit Project - Licensed under CC BY-NC-SA 4.0