Adding unit tests for the state machine of dotnet test. Starting the implementation of a state machine in dotnet test. Right now we only handle the TestSession:Terminate message.
Adding a message handler for the version check message. Also introduced an IDotnetTest that handles state and handlers (the state machine). Adding the test discover start message handler and introducing a test runner. Added the handler for the GetTestRunnerProcessInfo message. Also, modified dotnet test to have separate setter for the special message handlers for terminate and unknown messages and added a separate method to add new reporting channels to DotnetTest, so that it can handle the new listener for the test runner. Added the test runner test discovery handlers. Added handlers to deal with the test execution itself. Updated dotnet-test program to use the message handlers during design time. Added a test for the whole discover tests message flow. Added a test for the run tests full message exchange.
This commit is contained in:
parent
2aedd677c6
commit
7630337074
52 changed files with 2581 additions and 228 deletions
61
src/dotnet/commands/dotnet-test/DotnetTestExtensions.cs
Normal file
61
src/dotnet/commands/dotnet-test/DotnetTestExtensions.cs
Normal file
|
@ -0,0 +1,61 @@
|
|||
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using Microsoft.DotNet.Cli.Tools.Test;
|
||||
|
||||
namespace Microsoft.DotNet.Tools.Test
|
||||
{
|
||||
public static class DotnetTestExtensions
|
||||
{
|
||||
public static IDotnetTest AddNonSpecificMessageHandlers(
|
||||
this IDotnetTest dotnetTest,
|
||||
ITestMessagesCollection messages,
|
||||
IReportingChannel adapterChannel)
|
||||
{
|
||||
dotnetTest.TestSessionTerminateMessageHandler = new TestSessionTerminateMessageHandler(messages);
|
||||
dotnetTest.UnknownMessageHandler = new UnknownMessageHandler(adapterChannel);
|
||||
|
||||
dotnetTest.AddMessageHandler(new VersionCheckMessageHandler(adapterChannel));
|
||||
|
||||
return dotnetTest;
|
||||
}
|
||||
|
||||
public static IDotnetTest AddTestDiscoveryMessageHandlers(
|
||||
this IDotnetTest dotnetTest,
|
||||
IReportingChannel adapterChannel,
|
||||
IReportingChannelFactory reportingChannelFactory,
|
||||
ITestRunnerFactory testRunnerFactory)
|
||||
{
|
||||
dotnetTest.AddMessageHandler(
|
||||
new TestDiscoveryStartMessageHandler(testRunnerFactory, adapterChannel, reportingChannelFactory));
|
||||
|
||||
return dotnetTest;
|
||||
}
|
||||
|
||||
public static IDotnetTest AddTestRunMessageHandlers(
|
||||
this IDotnetTest dotnetTest,
|
||||
IReportingChannel adapterChannel,
|
||||
IReportingChannelFactory reportingChannelFactory,
|
||||
ITestRunnerFactory testRunnerFactory)
|
||||
{
|
||||
dotnetTest.AddMessageHandler(new GetTestRunnerProcessStartInfoMessageHandler(
|
||||
testRunnerFactory,
|
||||
adapterChannel,
|
||||
reportingChannelFactory));
|
||||
|
||||
return dotnetTest;
|
||||
}
|
||||
|
||||
public static IDotnetTest AddTestRunnnersMessageHandlers(
|
||||
this IDotnetTest dotnetTest,
|
||||
IReportingChannel adapterChannel)
|
||||
{
|
||||
dotnetTest.AddMessageHandler(new TestRunnerTestStartedMessageHandler(adapterChannel));
|
||||
dotnetTest.AddMessageHandler(new TestRunnerTestResultMessageHandler(adapterChannel));
|
||||
dotnetTest.AddMessageHandler(new TestRunnerTestFoundMessageHandler(adapterChannel));
|
||||
dotnetTest.AddMessageHandler(new TestRunnerTestCompletedMessageHandler(adapterChannel));
|
||||
|
||||
return dotnetTest;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue