@@ -178,6 +178,17 @@ await RetryHelper.RetryAsync(
178178 } , 3 , TimeSpan . FromSeconds ( 5 ) ) ;
179179 }
180180
181+ [ TestMethod ]
182+ public async Task RetryFailedTests_PassingFromFirstTime_UsingOldDotnetTest_MoveFiles_Succeeds ( )
183+ {
184+ DotnetMuxerResult result = await DotnetCli . RunAsync (
185+ $ "test \" { AssetFixture . TargetAssetPath } \" -- --retry-failed-tests 1",
186+ AcceptanceFixture . NuGetGlobalPackagesFolder . Path ,
187+ workingDirectory : AssetFixture . TargetAssetPath ) ;
188+
189+ Assert . AreEqual ( ExitCodes . Success , result . ExitCode ) ;
190+ }
191+
181192 public sealed class TestAssetFixture ( ) : TestAssetFixtureBase ( AcceptanceFixture . NuGetGlobalPackagesFolder )
182193 {
183194 public string TargetAssetPath => GetAssetPath ( AssetName ) ;
@@ -200,21 +211,29 @@ public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.
200211 <OutputType>Exe</OutputType>
201212 <UseAppHost>true</UseAppHost>
202213 <LangVersion>preview</LangVersion>
214+ <GenerateTestingPlatformEntryPoint>false</GenerateTestingPlatformEntryPoint>
215+ <TestingPlatformDotnetTestSupport>true</TestingPlatformDotnetTestSupport>
203216 </PropertyGroup>
204217 <ItemGroup>
205218 <PackageReference Include="Microsoft.Testing.Extensions.CrashDump" Version="$MicrosoftTestingPlatformVersion$" />
206219 <PackageReference Include="Microsoft.Testing.Extensions.Retry" Version="$MicrosoftTestingPlatformVersion$" />
207220 <PackageReference Include="Microsoft.Testing.Extensions.TrxReport" Version="$MicrosoftTestingPlatformVersion$" />
221+ <PackageReference Include="Microsoft.Testing.Platform.MSBuild" Version="$MicrosoftTestingPlatformVersion$" />
208222 </ItemGroup>
209223</Project>
210224
225+ #file dotnet.config
226+ [dotnet.test.runner]
227+ name= "VSTest"
228+
211229#file Program.cs
212230using Microsoft.Testing.Extensions;
213231using Microsoft.Testing.Extensions.TrxReport.Abstractions;
214232using Microsoft.Testing.Platform.Builder;
215233using Microsoft.Testing.Platform.Capabilities.TestFramework;
216234using Microsoft.Testing.Platform.Extensions.Messages;
217235using Microsoft.Testing.Platform.Extensions.TestFramework;
236+ using Microsoft.Testing.Platform.MSBuild;
218237using Microsoft.Testing.Platform.Services;
219238
220239public class Program
@@ -228,6 +247,7 @@ public static async Task<int> Main(string[] args)
228247 builder.AddCrashDumpProvider();
229248 builder.AddTrxReportProvider();
230249 builder.AddRetryProvider();
250+ builder.AddMSBuild();
231251 using ITestApplication app = await builder.BuildAsync();
232252 return await app.RunAsync();
233253 }
@@ -268,7 +288,7 @@ public async Task ExecuteRequestAsync(ExecuteRequestContext context)
268288 string resultDir = Environment.GetEnvironmentVariable("RESULTDIR")!;
269289 bool crash = Environment.GetEnvironmentVariable("CRASH") == "1";
270290
271- if (await TestMethod1(fail, resultDir, crash))
291+ if (TestMethod1(fail, resultDir, crash))
272292 {
273293 await context.MessageBus.PublishAsync(this, new TestNodeUpdateMessage(context.Request.Session.SessionUid,
274294 new TestNode() { Uid = "1", DisplayName = "TestMethod1", Properties = new(PassedTestNodeStateProperty.CachedInstance) }));
@@ -279,7 +299,7 @@ public async Task ExecuteRequestAsync(ExecuteRequestContext context)
279299 new TestNode() { Uid = "1", DisplayName = "TestMethod1", Properties = new(new FailedTestNodeStateProperty()) }));
280300 }
281301
282- if (await TestMethod2(fail, resultDir))
302+ if (TestMethod2(fail, resultDir))
283303 {
284304 await context.MessageBus.PublishAsync(this, new TestNodeUpdateMessage(context.Request.Session.SessionUid,
285305 new TestNode() { Uid = "2", DisplayName = "TestMethod2", Properties = new(PassedTestNodeStateProperty.CachedInstance) }));
@@ -290,7 +310,7 @@ public async Task ExecuteRequestAsync(ExecuteRequestContext context)
290310 new TestNode() { Uid = "2", DisplayName = "TestMethod2", Properties = new(new FailedTestNodeStateProperty()) }));
291311 }
292312
293- if (await TestMethod3(fail, resultDir))
313+ if (TestMethod3(fail, resultDir))
294314 {
295315 await context.MessageBus.PublishAsync(this, new TestNodeUpdateMessage(context.Request.Session.SessionUid,
296316 new TestNode() { Uid = "3", DisplayName = "TestMethod3", Properties = new(PassedTestNodeStateProperty.CachedInstance) }));
@@ -304,7 +324,7 @@ public async Task ExecuteRequestAsync(ExecuteRequestContext context)
304324 context.Complete();
305325 }
306326
307- private async Task< bool> TestMethod1(bool fail, string resultDir, bool crash)
327+ private bool TestMethod1(bool fail, string resultDir, bool crash)
308328 {
309329 if (crash)
310330 {
@@ -328,7 +348,7 @@ private async Task<bool> TestMethod1(bool fail, string resultDir, bool crash)
328348 return assert;
329349 }
330350
331- private async Task< bool> TestMethod2(bool fail, string resultDir)
351+ private bool TestMethod2(bool fail, string resultDir)
332352 {
333353 bool envVar = Environment.GetEnvironmentVariable("METHOD2") is null;
334354 System.Console.WriteLine("envVar " + envVar);
@@ -348,7 +368,7 @@ private async Task<bool> TestMethod2(bool fail, string resultDir)
348368 return assert;
349369 }
350370
351- private async Task< bool> TestMethod3(bool fail, string resultDir)
371+ private bool TestMethod3(bool fail, string resultDir)
352372 {
353373 bool envVar = Environment.GetEnvironmentVariable("METHOD3") is null;
354374
0 commit comments