C# Класс Microsoft.Silverlight.Testing.Harness.UnitTestHarness

A test harness for interacting with unit test providers such as Visual Studio Team Test's metadata.
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
AddLogProvider ( Microsoft.Silverlight.Testing.Harness.LogProvider provider ) : void

Adds a log provider to the listening log providers group.

EnqueueTestAssembly ( Assembly assembly, TestRunFilter runFilter ) : void

Enqueue a test assembly from a simple Assembly reference.

EnqueueTestAssembly ( IAssembly testAssembly, TestRunFilter runFilter ) : void

Enqueues a test assembly.

Initialize ( ) : void

Initialize the harness with a set of test assemblies.

PrepareCustomTestInstance ( CustomFrameworkUnitTest customTest ) : void

Sets the unit test harness property for a test case that inherits from the abstract base type 'CustomTest'.

QueueLogMessage ( Microsoft.Silverlight.Testing.Harness.LogMessage message ) : void

Enqueue a log message object for processing by the log providers.

RestartRunDispatcher ( ) : void

Restarts the run dispatcher.

Run ( ) : void

Begin running the test harness.

Make sure to subscribe to the Complete event before calling this method, in some harnesses this may be a synchronous Run followed immediately by the Complete event being fired.

TrackScenarioResult ( ScenarioResult result ) : void

Track the results for our execution and also track the fail state.

UnitTestHarness ( ) : System

Initiate unit test harness.

WriteLogFile ( string logName, string fileContent ) : void

Stores a log file for the test run. Depending on the execution environment, this call may not successful.

Защищенные методы

Метод Описание
CreateTestRunFilter ( UnitTestSettings settings ) : TestRunFilter

Creates the test run filter for the initial run.

OnIsDispatcherRunningChanged ( EventArgs e ) : void

Fires the play pause event.

OnPublishing ( EventArgs e ) : void

Call the Publishing event.

OnTestAssemblyCompleted ( TestAssemblyCompletedEventArgs e ) : void

Fires the test assembly completed event.

OnTestAssemblyStarting ( TestAssemblyStartingEventArgs e ) : void

Fires the test assembly starting event.

OnTestClassCompleted ( TestClassCompletedEventArgs e ) : void

Fires the test class completed event.

OnTestClassStarting ( TestClassStartingEventArgs e ) : void

Fires the test class starting event.

OnTestHarnessCompleted ( ) : void

Call the TestHarnessCompleted event.

OnTestMethodCompleted ( TestMethodCompletedEventArgs e ) : void

Notifies observers that a test method has been completed. Also clears the test panel's visual tree.

OnTestMethodStarting ( Microsoft.Silverlight.Testing.Harness.TestMethodStartingEventArgs e ) : void

Fires the test method starting event.

OnTestRunStarting ( TestRunStartingEventArgs e ) : void

Notifies observers that a test run has been started.

ProcessLogMessages ( ) : void

Process all queued log messages.

PublishFinalResult ( ) : void

If supported by any attached test service, this publishes the final test results. Typical harness implementations may immediately close the web browser channel upon receiving the message, so any other reporting should be done first.

PublishResults ( ) : void

Overrides the PublishResults method so that final reporting is only done once all other logging is finished.

RunNextStep ( ) : bool

Flush the current log manager and then perform the next invoke.

Приватные методы

Метод Описание
CalculateTotalMethods ( AssemblyManager assemblyManager, IAssembly assembly, TestRunFilter filter ) : int

Calculates the number of methods for a run.

CreateHarnessTasks ( ) : void

Creates the set of harness tasks to run and hooks up to the Complete event.

GlobalUnhandledExceptionListener ( object sender, EventArgs e ) : void

Listener event for any unhandled exceptions.

HarnessComplete ( object sender, EventArgs e ) : void

Event fired at the completion of the harness' work.

InitializeLogProviders ( ) : void

Initializes all log providers.

InitializeSettings ( UnitTestSettings settings ) : void

Fill member variables with any non-null settings of the same type.

IsReportingTestServiceConnected ( ) : bool

Checks if a reporting provider is connected to the test service.

PrepareTestAssemblyTasks ( ) : void

Determine what test assemblies need to be executed. Enqueue tasks for the unit test assembly providers to run the tests.

PublishFinalResults ( ) : void

Publish final results. If not yet ready, will keep waiting around as a work item until it is done.

ReportCodeCoverage ( TestServiceProvider testService ) : void
RunDispatcherComplete ( object sender, EventArgs e ) : void
SetOverallStatus ( string message ) : void

Immediately sets the overall status using a log message and processes the message queue.

Описание методов

AddLogProvider() публичный Метод

Adds a log provider to the listening log providers group.
public AddLogProvider ( Microsoft.Silverlight.Testing.Harness.LogProvider provider ) : void
provider Microsoft.Silverlight.Testing.Harness.LogProvider Log provider object.
Результат void

CreateTestRunFilter() защищенный Метод

Creates the test run filter for the initial run.
protected CreateTestRunFilter ( UnitTestSettings settings ) : TestRunFilter
settings UnitTestSettings The unit test settings.
Результат TestRunFilter

EnqueueTestAssembly() публичный Метод

Enqueue a test assembly from a simple Assembly reference.
public EnqueueTestAssembly ( Assembly assembly, TestRunFilter runFilter ) : void
assembly System.Reflection.Assembly The test assembly.
runFilter TestRunFilter The run filter settings for the test assembly's run.
Результат void

EnqueueTestAssembly() публичный Метод

Enqueues a test assembly.
public EnqueueTestAssembly ( IAssembly testAssembly, TestRunFilter runFilter ) : void
testAssembly IAssembly The test assembly metadata.
runFilter TestRunFilter The run filter settings for the test assembly's run.
Результат void

Initialize() публичный Метод

Initialize the harness with a set of test assemblies.
public Initialize ( ) : void
Результат void

OnIsDispatcherRunningChanged() защищенный Метод

Fires the play pause event.
protected OnIsDispatcherRunningChanged ( EventArgs e ) : void
e System.EventArgs Event data.
Результат void

OnPublishing() защищенный Метод

Call the Publishing event.
protected OnPublishing ( EventArgs e ) : void
e System.EventArgs The event arguments.
Результат void

OnTestAssemblyCompleted() защищенный Метод

Fires the test assembly completed event.
protected OnTestAssemblyCompleted ( TestAssemblyCompletedEventArgs e ) : void
e TestAssemblyCompletedEventArgs The event data.
Результат void

OnTestAssemblyStarting() защищенный Метод

Fires the test assembly starting event.
protected OnTestAssemblyStarting ( TestAssemblyStartingEventArgs e ) : void
e TestAssemblyStartingEventArgs The event data.
Результат void

OnTestClassCompleted() защищенный Метод

Fires the test class completed event.
protected OnTestClassCompleted ( TestClassCompletedEventArgs e ) : void
e TestClassCompletedEventArgs The event data.
Результат void

OnTestClassStarting() защищенный Метод

Fires the test class starting event.
protected OnTestClassStarting ( TestClassStartingEventArgs e ) : void
e TestClassStartingEventArgs The event data.
Результат void

OnTestHarnessCompleted() защищенный Метод

Call the TestHarnessCompleted event.
protected OnTestHarnessCompleted ( ) : void
Результат void

OnTestMethodCompleted() защищенный Метод

Notifies observers that a test method has been completed. Also clears the test panel's visual tree.
protected OnTestMethodCompleted ( TestMethodCompletedEventArgs e ) : void
e TestMethodCompletedEventArgs The event data.
Результат void

OnTestMethodStarting() защищенный Метод

Fires the test method starting event.
protected OnTestMethodStarting ( Microsoft.Silverlight.Testing.Harness.TestMethodStartingEventArgs e ) : void
e Microsoft.Silverlight.Testing.Harness.TestMethodStartingEventArgs The event data.
Результат void

OnTestRunStarting() защищенный Метод

Notifies observers that a test run has been started.
protected OnTestRunStarting ( TestRunStartingEventArgs e ) : void
e TestRunStartingEventArgs The event data.
Результат void

PrepareCustomTestInstance() публичный Метод

Sets the unit test harness property for a test case that inherits from the abstract base type 'CustomTest'.
public PrepareCustomTestInstance ( CustomFrameworkUnitTest customTest ) : void
customTest CustomFrameworkUnitTest A CustomText instance.
Результат void

ProcessLogMessages() защищенный Метод

Process all queued log messages.
protected ProcessLogMessages ( ) : void
Результат void

PublishFinalResult() защищенный Метод

If supported by any attached test service, this publishes the final test results. Typical harness implementations may immediately close the web browser channel upon receiving the message, so any other reporting should be done first.
protected PublishFinalResult ( ) : void
Результат void

PublishResults() защищенный Метод

Overrides the PublishResults method so that final reporting is only done once all other logging is finished.
protected PublishResults ( ) : void
Результат void

QueueLogMessage() публичный Метод

Enqueue a log message object for processing by the log providers.
public QueueLogMessage ( Microsoft.Silverlight.Testing.Harness.LogMessage message ) : void
message Microsoft.Silverlight.Testing.Harness.LogMessage The log message object.
Результат void

RestartRunDispatcher() публичный Метод

Restarts the run dispatcher.
public RestartRunDispatcher ( ) : void
Результат void

Run() публичный Метод

Begin running the test harness.
Make sure to subscribe to the Complete event before calling this method, in some harnesses this may be a synchronous Run followed immediately by the Complete event being fired.
public Run ( ) : void
Результат void

RunNextStep() защищенный Метод

Flush the current log manager and then perform the next invoke.
protected RunNextStep ( ) : bool
Результат bool

TrackScenarioResult() публичный Метод

Track the results for our execution and also track the fail state.
public TrackScenarioResult ( ScenarioResult result ) : void
result ScenarioResult Scenario result to process.
Результат void

UnitTestHarness() публичный Метод

Initiate unit test harness.
public UnitTestHarness ( ) : System
Результат System

WriteLogFile() публичный Метод

Stores a log file for the test run. Depending on the execution environment, this call may not successful.
public WriteLogFile ( string logName, string fileContent ) : void
logName string The name of the log file.
fileContent string The log file content as a string.
Результат void