IGLib
1.7.2
The IGLib base library EXTENDED - with other lilbraries and applications.
|
A WorkItem may be an individual test case, a fixture or a higher level grouping of tests. All WorkItems inherit from the abstract WorkItem class, which uses the template pattern to allow derived classes to perform work in whatever way is needed. More...
Public Member Functions | |
WorkItem (Test test) | |
Construct a WorkItem for a particular test. More... | |
void | InitializeContext (TestExecutionContext context) |
Initialize the TestExecutionContext. This must be done before executing the WorkItem. More... | |
virtual void | Execute () |
Execute the current work item, including any child work items. More... | |
Static Public Member Functions | |
static WorkItem | CreateWorkItem (ITest test, ITestFilter filter) |
Creates a work item. More... | |
Protected Member Functions | |
abstract void | PerformWork () |
Method that performs actually performs the work. It should set the State to WorkItemState.Complete when done. More... | |
void | WorkItemComplete () |
Method called by the derived class when all work is complete More... | |
Properties | |
WorkItemState | State [get] |
Gets the current state of the WorkItem More... | |
Test | Test [get] |
The test being executed by the work item More... | |
TestExecutionContext | Context [get] |
The execution context More... | |
List< ITestAction > | Actions [get] |
The test actions to be performed before and after this test More... | |
TestResult | Result [get, protected set] |
The test result More... | |
Events | |
EventHandler | Completed |
Event triggered when the item is complete More... | |
Private Member Functions | |
void | RunTestOnOwnThread (int timeout, ApartmentState apartment) |
void | RunTest () |
Private Attributes | |
WorkItemState | _state |
Test | _test |
TestExecutionContext | _context |
List< ITestAction > | _actions = new List<ITestAction>() |
Static Private Attributes | |
static Logger | log = InternalTrace.GetLogger("WorkItem") |
A WorkItem may be an individual test case, a fixture or a higher level grouping of tests. All WorkItems inherit from the abstract WorkItem class, which uses the template pattern to allow derived classes to perform work in whatever way is needed.
A WorkItem is created with a particular TestExecutionContext and is responsible for re-establishing that context in the current thread before it begins or resumes execution.
|
inline |
Construct a WorkItem for a particular test.
test | The test that the WorkItem will run |
References NUnit.Framework.Internal.Test.MakeTestResult().
|
inlinestatic |
Creates a work item.
test | The test for which this WorkItem is being created. |
filter | The filter to be used in selecting any child Tests. |
Referenced by NUnit.Framework.Internal.Execution.CompositeWorkItem.CreateChildWorkItems(), NUnit.Framework.Api.NUnitTestAssemblyRunner.RunAsync(), NUnit.TestUtilities.TestBuilder.RunTest(), and NUnit.TestUtilities.TestBuilder.RunTestSuite().
|
inline |
Initialize the TestExecutionContext. This must be done before executing the WorkItem.
Originally, the context was provided in the constructor but delaying initialization of the context until the item is about to be dispatched allows changes in the parent context during OneTimeSetUp to be reflected in the child.
context | The TestExecutionContext to use |
References NUnit.Framework.Internal.Test.Method, NUnit.Framework.Interfaces.IMethodInfo.MethodInfo, NUnit.Framework.Interfaces.ITypeInfo.Type, and NUnit.Framework.Internal.Test.TypeInfo.
Referenced by NUnit.Framework.Api.NUnitTestAssemblyRunner.RunAsync(), NUnit.Framework.Internal.Execution.CompositeWorkItem.RunChildren(), NUnit.TestUtilities.TestBuilder.RunTest(), and NUnit.TestUtilities.TestBuilder.RunTestSuite().
|
inlinevirtual |
Execute the current work item, including any child work items.
Reimplemented in NUnit.TestUtilities.FakeWorkItem, and NUnit.TestUtilities.FakeWorkItem.
References NUnit.Framework.Internal.TestExecutionContext.TestCaseTimeout, and NUnit.Framework.Internal.PropertyNames.Timeout.
Referenced by NUnit.Framework.Internal.Execution.SimpleWorkItemDispatcher.Dispatch(), NUnit.Framework.Internal.Execution.SimpleWorkItemDispatcher.RunnerThreadProc(), NUnit.TestUtilities.TestBuilder.RunTest(), and NUnit.TestUtilities.TestBuilder.RunTestSuite().
|
inlineprivate |
|
inlineprivate |
References NUnit.Framework.Internal.TestExecutionContext.CurrentResult, NUnit.Framework.Internal.TestExecutionContext.CurrentTest, NUnit.Framework.Internal.TestExecutionContext.EstablishExecutionEnvironment(), NUnit.Framework.Internal.TestExecutionContext.StartTicks, NUnit.Framework.Internal.TestExecutionContext.StartTime, and NUnit.Framework.Interfaces.ITestListener.TestStarted().
|
protectedpure virtual |
Method that performs actually performs the work. It should set the State to WorkItemState.Complete when done.
Implemented in NUnit.TestUtilities.FakeWorkItem, NUnit.TestUtilities.FakeWorkItem, NUnit.Framework.Internal.Execution.CompositeWorkItem, and NUnit.Framework.Internal.Execution.SimpleWorkItem.
|
inlineprotected |
Method called by the derived class when all work is complete
References NUnit.Framework.Interfaces.ITestListener.TestFinished().
|
staticprivate |
|
private |
|
private |
|
private |
|
private |
|
get |
Gets the current state of the WorkItem
Referenced by NUnit.TestUtilities.TestBuilder.RunTest(), and NUnit.TestUtilities.TestBuilder.RunTestSuite().
|
get |
The test being executed by the work item
|
get |
The execution context
|
get |
The test actions to be performed before and after this test
|
getprotected set |
EventHandler NUnit.Framework.Internal.Execution.WorkItem.Completed |
Event triggered when the item is complete
Referenced by NUnit.Framework.Internal.Execution.CompositeWorkItem.OnChildCompleted(), and NUnit.Framework.Internal.Execution.CompositeWorkItem.RunChildren().