C# Class Microsoft.Silverlight.Testing.Harness.UnitTestHarness

A test harness for interacting with unit test providers such as Visual Studio Team Test's metadata.
Afficher le fichier Open project: garyjohnson/wpnest Class Usage Examples

Méthodes publiques

Méthode Description
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.

Méthodes protégées

Méthode Description
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.

Private Methods

Méthode Description
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.

Method Details

AddLogProvider() public méthode

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.
Résultat void

CreateTestRunFilter() protected méthode

Creates the test run filter for the initial run.
protected CreateTestRunFilter ( UnitTestSettings settings ) : TestRunFilter
settings UnitTestSettings The unit test settings.
Résultat TestRunFilter

EnqueueTestAssembly() public méthode

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.
Résultat void

EnqueueTestAssembly() public méthode

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.
Résultat void

Initialize() public méthode

Initialize the harness with a set of test assemblies.
public Initialize ( ) : void
Résultat void

OnIsDispatcherRunningChanged() protected méthode

Fires the play pause event.
protected OnIsDispatcherRunningChanged ( EventArgs e ) : void
e System.EventArgs Event data.
Résultat void

OnPublishing() protected méthode

Call the Publishing event.
protected OnPublishing ( EventArgs e ) : void
e System.EventArgs The event arguments.
Résultat void

OnTestAssemblyCompleted() protected méthode

Fires the test assembly completed event.
protected OnTestAssemblyCompleted ( TestAssemblyCompletedEventArgs e ) : void
e TestAssemblyCompletedEventArgs The event data.
Résultat void

OnTestAssemblyStarting() protected méthode

Fires the test assembly starting event.
protected OnTestAssemblyStarting ( TestAssemblyStartingEventArgs e ) : void
e TestAssemblyStartingEventArgs The event data.
Résultat void

OnTestClassCompleted() protected méthode

Fires the test class completed event.
protected OnTestClassCompleted ( TestClassCompletedEventArgs e ) : void
e TestClassCompletedEventArgs The event data.
Résultat void

OnTestClassStarting() protected méthode

Fires the test class starting event.
protected OnTestClassStarting ( TestClassStartingEventArgs e ) : void
e TestClassStartingEventArgs The event data.
Résultat void

OnTestHarnessCompleted() protected méthode

Call the TestHarnessCompleted event.
protected OnTestHarnessCompleted ( ) : void
Résultat void

OnTestMethodCompleted() protected méthode

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.
Résultat void

OnTestMethodStarting() protected méthode

Fires the test method starting event.
protected OnTestMethodStarting ( Microsoft.Silverlight.Testing.Harness.TestMethodStartingEventArgs e ) : void
e Microsoft.Silverlight.Testing.Harness.TestMethodStartingEventArgs The event data.
Résultat void

OnTestRunStarting() protected méthode

Notifies observers that a test run has been started.
protected OnTestRunStarting ( TestRunStartingEventArgs e ) : void
e TestRunStartingEventArgs The event data.
Résultat void

PrepareCustomTestInstance() public méthode

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.
Résultat void

ProcessLogMessages() protected méthode

Process all queued log messages.
protected ProcessLogMessages ( ) : void
Résultat void

PublishFinalResult() protected méthode

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
Résultat void

PublishResults() protected méthode

Overrides the PublishResults method so that final reporting is only done once all other logging is finished.
protected PublishResults ( ) : void
Résultat void

QueueLogMessage() public méthode

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.
Résultat void

RestartRunDispatcher() public méthode

Restarts the run dispatcher.
public RestartRunDispatcher ( ) : void
Résultat void

Run() public méthode

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
Résultat void

RunNextStep() protected méthode

Flush the current log manager and then perform the next invoke.
protected RunNextStep ( ) : bool
Résultat bool

TrackScenarioResult() public méthode

Track the results for our execution and also track the fail state.
public TrackScenarioResult ( ScenarioResult result ) : void
result ScenarioResult Scenario result to process.
Résultat void

UnitTestHarness() public méthode

Initiate unit test harness.
public UnitTestHarness ( ) : System
Résultat System

WriteLogFile() public méthode

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.
Résultat void