-
Notifications
You must be signed in to change notification settings - Fork 291
Closed
Milestone
Description
Describe the bug
When supplying your own entrypoint, with disabled GenerateTestingPlatformEntryPoint, CodeCoverage and MSTest aren't injected into the SelfRegisteredExtensions.
Steps To Reproduce
<Project Sdk="MSTest.Sdk">
<PropertyGroup>
<GenerateTestingPlatformEntryPoint>false</GenerateTestingPlatformEntryPoint>
</PropertyGroup>
</Project>
Program.cs:
public static async Task<int> Main(string[] args)
{
var builder = await TestApplication.CreateBuilderAsync(args);
SelfRegisteredExtensions.AddSelfRegisteredExtensions(builder, args);
using var app = await builder.BuildAsync();
return await app.RunAsync().ConfigureAwait(false);
}
Fails with:
Unhandled exception. System.InvalidOperationException: Testframework-Adapter not registered. Use "ITestApplicationBuilder.RegisterTestFramework", to register.
at Microsoft.Testing.Platform.Builder.TestApplicationBuilder.BuildAsync() in /_/src/Platform/Microsoft.Testing.Platform/Builder/TestApplicationBuilder.cs:line 102`
Expected behavior
AddSelfRegisteredExtensions shouldn't omit TestPlatform registration.
Actual behavior
AddSelfRegisteredExtensions contains additional calls, when enabling GenerateTestingPlatformEntryPoint:
public static void AddSelfRegisteredExtensions(this ITestApplicationBuilder builder, string[] args)
{
Microsoft.Testing.Platform.MSBuild.TestingPlatformBuilderHook.AddExtensions(builder, args);
Microsoft.Testing.Extensions.Telemetry.TestingPlatformBuilderHook.AddExtensions(builder, args);
Microsoft.VisualStudio.TestTools.UnitTesting.TestingPlatformBuilderHook.AddExtensions(builder, args);
Microsoft.Testing.Extensions.Retry.TestingPlatformBuilderHook.AddExtensions(builder, args);
Microsoft.Testing.Extensions.HangDump.TestingPlatformBuilderHook.AddExtensions(builder, args);
Microsoft.Testing.Extensions.CrashDump.TestingPlatformBuilderHook.AddExtensions(builder, args);
Microsoft.Testing.Extensions.CodeCoverage.TestingPlatformBuilderHook.AddExtensions(builder, args);
Microsoft.Testing.Extensions.TrxReport.TestingPlatformBuilderHook.AddExtensions(builder, args);
}
Versus, when disabling entrypoint generation:
public static void AddSelfRegisteredExtensions(this ITestApplicationBuilder builder, string[] args)
{
Microsoft.Testing.Platform.MSBuild.TestingPlatformBuilderHook.AddExtensions(builder, args);
Microsoft.Testing.Extensions.Telemetry.TestingPlatformBuilderHook.AddExtensions(builder, args);
Microsoft.Testing.Extensions.Retry.TestingPlatformBuilderHook.AddExtensions(builder, args);
Microsoft.Testing.Extensions.HangDump.TestingPlatformBuilderHook.AddExtensions(builder, args);
Microsoft.Testing.Extensions.CrashDump.TestingPlatformBuilderHook.AddExtensions(builder, args);
Microsoft.Testing.Extensions.TrxReport.TestingPlatformBuilderHook.AddExtensions(builder, args);
}
When carbon copying the generated entrypoint code (which this is) there must not be different observed behavior.
Additional context
Metadata
Metadata
Assignees
Labels
No labels