DefaultTestManager Class
Supervises the process in which the test cases run and also provides logging and checking functions for test cases. The test manager supports the test case code generated by Spec Explorer.
Namespace: Microsoft.SpecExplorer.Runtime.Testing
Assembly: Microsoft.SpecExplorer.Runtime (in Microsoft.SpecExplorer.Runtime.dll)
Usage
'Usage
Syntax
'Declaration
public class DefaultTestManager : ITestManager
Example
The following Cord script and C# example shows an implementation of a custom test class, MyTestClass, and a custom test site, MyTestSite.
In the Cord script, the Main configuration block sets some of the test generation switches, in particular, the TestClassBase switch, which indicates which base test class Spec Explorer should use in the generated test code.
In the C# code, the InitializeTestManager method of the test class initializes the test manager that will supervise the execution of the test case. Here the test manager is initialized to use a custom test site, MyTestSite.
config Main
{
switch GeneratedTestPath = "..\\TestSuite";
switch GeneratedTestNamespace = "TypeBindingSample";
switch TestClassBase = "TypeBindingSample.MyTestClass";
// Set other switches here.
}
using System;
using Microsoft.SpecExplorer.Runtime.Testing;
namespace TypeBindingSample
{
// The custom test class.
public class MyTestClass : VsTestClassBase
{
// Initialize the test manager to use a custom test site.
public override void InitializeTestManager()
{
this.Manager = new DefaultTestManager(new MyTestSite(), 32, 16);
}
}
// The custom test site.
public class MyTestSite : IBasicTestSite
{
public void Assert(bool condition, string description)
{
if (!condition)
{
Console.WriteLine("Assert failed: " + description);
throw new Exception(description);
}
}
// Implement the remaining IBasicTestSite methods here.
}
}
Remarks
When creating a custom test class, you might need to create a default test manager or need to call its methods from your implementation of the test class. The VsTestClassBase class provides a test class that works within the Visual Studio Team Test environment. The GeneratedTestClassBase class provides an abstract base implementation of a test class, which can be used to define a test class that can integrate with another test environment.
This class is initialized with a reference to an IBasicTestSite object, and some of the methods of this class call methods of the IBasicTestSite object.
Inheritance Hierarchy
System.Object
Microsoft.SpecExplorer.Runtime.Testing.DefaultTestManager
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Platforms
Development Platforms
Microsoft Windows 7, Microsoft Windows Vista, Microsoft Windows XP SP2 or later, Microsoft Windows Server 2008, Microsoft Windows Server 2003
Change History
See Also
Reference
DefaultTestManager Members
Microsoft.SpecExplorer.Runtime.Testing Namespace
GeneratedTestClassBase
VsTestClassBase
IBasicTestSite