Skip to content

Commit

Permalink
Revert changes to playground
Browse files Browse the repository at this point in the history
  • Loading branch information
Evangelink committed Aug 5, 2024
1 parent b9b020b commit 4901764
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 827 deletions.
16 changes: 0 additions & 16 deletions samples/Playground/Playground.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,6 @@
<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" />
<PackageReference Include="StreamJsonRpc" />
<ProjectReference Include="$(RepoRoot)src\Platform\Microsoft.Testing.Extensions.Telemetry\Microsoft.Testing.Extensions.Telemetry.csproj" />
</ItemGroup>

<ItemGroup>
Expand All @@ -34,10 +24,4 @@
</None>
</ItemGroup>

<ItemGroup>
<ProjectCapability Include="DiagnoseCapabilities" />
<ProjectCapability Include="TestingPlatformServer" />
<ProjectCapability Include="TestContainer" />
</ItemGroup>

</Project>
44 changes: 6 additions & 38 deletions samples/Playground/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,8 @@
using System.Reflection;

using Microsoft.Testing.Platform.Builder;
using Microsoft.Testing.Platform.ServerMode.IntegrationTests.Messages.V100;
using Microsoft.VisualStudio.TestTools.UnitTesting;

using MSTest.Acceptance.IntegrationTests.Messages.V100;

namespace Playground;

public class Program
Expand All @@ -18,41 +15,12 @@ public static async Task<int> Main(string[] args)
// Opt-out telemetry
Environment.SetEnvironmentVariable("DOTNET_CLI_TELEMETRY_OPTOUT", "1");

if (Environment.GetEnvironmentVariable("TESTSERVERMODE") != "1")
{
// To attach to the children
// Microsoft.Testing.TestInfrastructure.DebuggerUtility.AttachCurrentProcessToParentVSProcess();
ITestApplicationBuilder testApplicationBuilder = await TestApplication.CreateBuilderAsync(args);
testApplicationBuilder.AddMSTest(() => [Assembly.GetEntryAssembly()!]);

// Enable Trx
// testApplicationBuilder.AddTrxReportProvider();

// Enable Telemetry
// testApplicationBuilder.AddAppInsightsTelemetryProvider();
using ITestApplication testApplication = await testApplicationBuilder.BuildAsync();
return await testApplication.RunAsync();
}
else
{
Environment.SetEnvironmentVariable("TESTSERVERMODE", "0");
using TestingPlatformClient client = await TestingPlatformClientFactory.StartAsServerAndConnectAsync(Environment.ProcessPath!, enableDiagnostic: true);

await client.InitializeAsync();
List<TestNodeUpdate> testNodeUpdates = new();
ResponseListener discoveryResponse = await client.DiscoverTestsAsync(Guid.NewGuid(), node =>
{
testNodeUpdates.AddRange(node);
return Task.CompletedTask;
});
await discoveryResponse.WaitCompletionAsync();

ResponseListener runRequest = await client.RunTestsAsync(Guid.NewGuid(), testNodeUpdates.Select(x => x.Node).ToArray(), node => Task.CompletedTask);
await runRequest.WaitCompletionAsync();

await client.ExitAsync();
ITestApplicationBuilder testApplicationBuilder = await TestApplication.CreateBuilderAsync(args);
testApplicationBuilder.AddMSTest(() => [Assembly.GetEntryAssembly()!]);

return 0;
}
// Enable Trx
// testApplicationBuilder.AddTrxReportProvider();
using ITestApplication testApplication = await testApplicationBuilder.BuildAsync();
return await testApplication.RunAsync();
}
}
Loading

0 comments on commit 4901764

Please sign in to comment.