Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions samples/Playground/Playground.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,8 @@
<ItemGroup>
<ProjectReference Include="$(RepoRoot)src\Platform\Microsoft.Testing.Platform\Microsoft.Testing.Platform.csproj" />
<ProjectReference Include="$(RepoRoot)src\Adapter\MSTest.TestAdapter\MSTest.TestAdapter.csproj" />
<ProjectReference Include="$(RepoRoot)src\Analyzers\MSTest.Analyzers.CodeFixes\MSTest.Analyzers.CodeFixes.csproj"
PrivateAssets="all"
ReferenceOutputAssembly="false"
OutputItemType="Analyzer" />
<ProjectReference Include="$(RepoRoot)src\Analyzers\MSTest.Analyzers\MSTest.Analyzers.csproj"
PrivateAssets="all"
ReferenceOutputAssembly="false"
OutputItemType="Analyzer" />
<ProjectReference Include="$(RepoRoot)src\Analyzers\MSTest.Analyzers.CodeFixes\MSTest.Analyzers.CodeFixes.csproj" PrivateAssets="all" ReferenceOutputAssembly="false" OutputItemType="Analyzer" />
<ProjectReference Include="$(RepoRoot)src\Analyzers\MSTest.Analyzers\MSTest.Analyzers.csproj" PrivateAssets="all" ReferenceOutputAssembly="false" OutputItemType="Analyzer" />
<PackageReference Include="StreamJsonRpc" />
<ProjectReference Include="$(RepoRoot)src\Platform\Microsoft.Testing.Extensions.Telemetry\Microsoft.Testing.Extensions.Telemetry.csproj" />
</ItemGroup>
Expand All @@ -39,4 +33,6 @@
<ProjectCapability Include="TestContainer" />
</ItemGroup>

<!-- Import the capabilities for the Microsoft.Testing.Platform -->
<Import Project="$(RepoRoot)src\Platform\Microsoft.Testing.Platform\buildMultiTargeting\Microsoft.Testing.Platform.props"/>
</Project>
5 changes: 3 additions & 2 deletions samples/Playground/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Microsoft.Testing.Platform.Extensions.TestHostControllers;
using Microsoft.Testing.Platform.Messages;
using Microsoft.Testing.Platform.ServerMode.IntegrationTests.Messages.V100;
using Microsoft.Testing.Platform.Services;
using Microsoft.VisualStudio.TestTools.UnitTesting;

using MSTest.Acceptance.IntegrationTests.Messages.V100;
Expand All @@ -24,12 +25,12 @@ public static async Task<int> Main(string[] args)
if (Environment.GetEnvironmentVariable("TESTSERVERMODE") != "1")
{
// To attach to the children
// Microsoft.Testing.TestInfrastructure.DebuggerUtility.AttachCurrentProcessToParentVSProcess();
Microsoft.Testing.TestInfrastructure.DebuggerUtility.AttachCurrentProcessToParentVSProcess();
ITestApplicationBuilder testApplicationBuilder = await TestApplication.CreateBuilderAsync(args);
testApplicationBuilder.AddMSTest(() => [Assembly.GetEntryAssembly()!]);

// Custom test host controller extension
// testApplicationBuilder.TestHostControllers.AddProcessLifetimeHandler(s => new OutOfProc(s.GetMessageBus()));
testApplicationBuilder.TestHostControllers.AddProcessLifetimeHandler(s => new OutOfProc(s.GetMessageBus()));

// Enable Trx
// testApplicationBuilder.AddTrxReportProvider();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ protected override async Task<int> InternalRunAsync()
_testFrameworkManager,
_testHostManager,
new MessageBusProxy(),
ServiceProvider.GetCommandLineOptions().IsOptionSet(PlatformCommandLineProvider.DiscoverTestsOptionKey)));
ServiceProvider.GetCommandLineOptions().IsOptionSet(PlatformCommandLineProvider.DiscoverTestsOptionKey),
false));

ITelemetryCollector telemetry = ServiceProvider.GetTelemetryCollector();
ITelemetryInformation telemetryInformation = ServiceProvider.GetTelemetryInformation();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,8 @@ private async Task<ResponseArgsBase> ExecuteRequestAsync(RequestArgsBase args, s
_testFrameworkManager,
_testSessionManager,
new MessageBusProxy(),
method == JsonRpcMethods.TestingDiscoverTests));
method == JsonRpcMethods.TestingDiscoverTests,
true));

DateTimeOffset adapterLoadStop = _clock.UtcNow;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ internal class TestFrameworkBuilderData(ServiceProvider serviceProvider, ITestEx
ITestFrameworkInvoker testExecutionRequestInvoker, ITestExecutionFilterFactory testExecutionFilterFactory,
IPlatformOutputDevice platformOutputDisplayService, IEnumerable<IDataConsumer> serverPerCallConsumers,
TestFrameworkManager testFrameworkManager, TestHostManager testSessionManager, MessageBusProxy messageBusProxy,
bool isForDiscoveryRequest)
bool isForDiscoveryRequest,
bool isJsonRpcProtocol)
{
public ServiceProvider ServiceProvider { get; } = serviceProvider;

Expand All @@ -36,4 +37,6 @@ internal class TestFrameworkBuilderData(ServiceProvider serviceProvider, ITestEx
public MessageBusProxy MessageBusProxy { get; } = messageBusProxy;

public bool IsForDiscoveryRequest { get; } = isForDiscoveryRequest;

public bool IsJsonRpcProtocol { get; } = isJsonRpcProtocol;
}
Original file line number Diff line number Diff line change
Expand Up @@ -740,10 +740,12 @@ private async Task<ITestFramework> BuildTestFrameworkAsync(TestFrameworkBuilderD

IDataConsumer[] dataConsumerServices = dataConsumersBuilder.ToArray();

// Build the message hub
// Build the message bus
// If we're running discovery command line we don't want to process any messages coming from the adapter so we filter out all extensions
// adding a custom message bus that will simply forward to the output display for better performance
if (serviceProvider.GetCommandLineOptions().IsOptionSet(PlatformCommandLineProvider.DiscoverTestsOptionKey))
if (serviceProvider.GetCommandLineOptions().IsOptionSet(PlatformCommandLineProvider.DiscoverTestsOptionKey)
// In case of server mode the discovery is handled by the ServerHost using the standard message bus
&& !testFrameworkBuilderData.IsJsonRpcProtocol)
{
ListTestsMessageBus concreteMessageBusService = new(
serviceProvider.GetTestFramework(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
<?xml version="1.0" encoding="utf-8" ?>
<Project>
<ItemGroup>
<TestingPlatformMetadata Include="ExitOnProcessExitCapability" >
<!-- For VS Test Explorer -->
<ProjectCapability Include="TestingPlatformServer.ExitOnProcessExitCapability">
Comment thread
MarcoRossignoli marked this conversation as resolved.
<Description>--exit-on-process-exit: Close the test process if specific process exits. Process PID must be provided.</Description>
</TestingPlatformMetadata>
</ProjectCapability>
<ProjectCapability Include="TestingPlatformServer.UseListTestsOptionForDiscoveryCapability">
<Description>The implementation handle the --list-tests in --server [jsonrpc] during discovery</Description>
</ProjectCapability>
</ItemGroup>
</Project>