How to: Add a Test-Type Specific Page To The Run Configuration Dialog Box
The test run configuration editor specifies global settings that affect details of how tests are run. These details include the location of the test, whether code coverage data is gathered, and test-type specific settings that affect the way all instances of a particular test type are run. To connect to and add pages to the run configuration dialog box, you must implement specific interfaces.
The steps for adding a page to the run configuration dialog box are as follows:
Implement the ITestTypeSpecificRunConfigurationData interface
Implement the IRunConfigurationCustomEditor interface
Update the TUIP to advertise Run Configuration integration
Implement ITestTypeSpecificRunConfigurationData
To implement ITestTypeSpecificRunConfigurationData
Implement ITestTypeSpecificRunConfigurationData, and encapsulate in this class all the properties of your test type specific run configuration settings. Your class must be [Serializable] and have a default constructor. The default constructor can be private.
Private Property RunConfigurationInformation() As String Get End Get
string RunConfigurationInformation { get; }
Returns a string version of the test type specific run configuration data.
Implement IRunConfigurationCustomEditor
To implement IRunConfigurationCustomEditor
Implement IRunConfigurationCustomEditor to define the UI of the editor that you want displayed in your test-type specific page of the run configuration dialog box. Your class should also be derived from UserControl.
void Initialize(System.IServiceProvider serviceProvider, TestRun run)
void Initialize(System.IServiceProvider serviceProvider, TestRun run);
Here, you initialize the editor to reflect values of current test run settings, or to establish default values.
void OnCommonDataDirty(Object sender, CommonRunConfigurationDirtyEventArgs dirtyEventArgs)
void OnCommonDataDirty(object sender, CommonRunConfigurationDirtyEventArgs dirtyEventArgs);
This is called when common run configuration data has been modified by the user outside this editor. If your settings rely on common run configuration data, this method should perform an appropriate action.
Event DataGetDirty As EventHandler
event EventHandler DataGetDirty;
Raise this event when data in the editor becomes "dirty" (changed).
Boolean VerifyData()
bool VerifyData();
Verify the data in the editor. If necessary, prompt the user to correct results. Finally, return a Boolean value that indicates whether the data entered has been verified.
Private Property TestType() As TestType Get End Get
TestType TestType { get; }
Return the associated test type identifier.
void SetData(ITestTypeSpecificRunConfigurationData data)
void SetData(ITestTypeSpecificRunConfigurationData data);
Set the test-specific run configuration data and update the UI appropriately.
ITestTypeSpecificRunConfigurationData GetData()
ITestTypeSpecificRunConfigurationData GetData();
Return the test-specific run configuration data.
Private Property Description() As String Get End Get
string Description { get; }
This is a description of the editor to help users understand what it does.
Private Property HelpKeyword() As String Get End Get
string HelpKeyword { get; }
This is the F1 Help keyword for this editor.
Update the TUIP to Advertise Run Configuration Integration
To update the TUIP
Update the TUIP to advertise the integration of run configuration.
Public MustOverride ReadOnly Property RunConfigurationEditor() As IRunConfigurationCustomEditor
public abstract IRunConfigurationCustomEditor RunConfigurationEditor { get; }
Implement this method to return an instance of your class that implements IRunConfigurationCustomEditor.
See Also
Tasks
How to: Implement a Basic Test Type