File tree 5 files changed +61
-4
lines changed
TestAssets/TestProjects/TestAppSimpleWithRetry
5 files changed +61
-4
lines changed Original file line number Diff line number Diff line change 174
174
<MicrosoftTestPlatformCLIPackageVersion >17.14.0-preview-25157-01</MicrosoftTestPlatformCLIPackageVersion >
175
175
<MicrosoftTestPlatformBuildPackageVersion >17.14.0-preview-25157-01</MicrosoftTestPlatformBuildPackageVersion >
176
176
</PropertyGroup >
177
- <PropertyGroup >
178
- <!-- Dependencies from https://github.com/Microsoft/testfx -->
179
- <MicrosoftTestingPlatformVersion >1.5.0-preview.24602.2</MicrosoftTestingPlatformVersion >
180
- </PropertyGroup >
181
177
<PropertyGroup >
182
178
<!-- Dependencies from https://github.com/dotnet/roslyn-analyzers -->
183
179
<MicrosoftCodeAnalysisNetAnalyzersVersion >10.0.0-preview.25155.1</MicrosoftCodeAnalysisNetAnalyzersVersion >
Original file line number Diff line number Diff line change
1
+ <Project Sdk =" Microsoft.NET.Sdk" >
2
+ <Import Project =" $([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), testAsset.props))\testAsset.props" />
3
+
4
+ <PropertyGroup >
5
+ <TargetFramework >$(CurrentTargetFramework)</TargetFramework >
6
+ <OutputType >Exe</OutputType >
7
+ <TestingPlatformCommandLineArguments >$(TestingPlatformCommandLineArguments) --retry-failed-tests 3</TestingPlatformCommandLineArguments >
8
+ <EnableMSTestRunner >true</EnableMSTestRunner >
9
+ </PropertyGroup >
10
+
11
+ <ItemGroup >
12
+ <PackageReference Include =" MSTest" Version =" $(MSTestVersion)" />
13
+ <PackageReference Include =" Microsoft.Testing.Extensions.Retry" Version =" $(MicrosoftTestingPlatformVersion)" />
14
+ </ItemGroup >
15
+ </Project >
Original file line number Diff line number Diff line change
1
+ // Copyright (c) .NET Foundation and contributors. All rights reserved.
2
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
+
4
+ using System ;
5
+ using System . Linq ;
6
+ using Microsoft . VisualStudio . TestTools . UnitTesting ;
7
+
8
+ [ TestClass ]
9
+ public class TestClass1
10
+ {
11
+ [ TestMethod ]
12
+ public void TestMethod1 ( )
13
+ {
14
+ if ( Environment . GetCommandLineArgs ( ) . Any ( arg => arg . Contains ( "Retries" ) && ! arg . EndsWith ( "2" ) ) )
15
+ {
16
+ Assert . Fail ( "Failing..." ) ;
17
+ }
18
+ }
19
+ }
Original file line number Diff line number Diff line change
1
+ [dotnet.test:runner]
2
+ name= "Microsoft.Testing.Platform"
Original file line number Diff line number Diff line change @@ -36,6 +36,31 @@ public void RunTestProjectWithNoTests_ShouldReturnExitCodeGenericFailure(string
36
36
result . ExitCode . Should ( ) . Be ( ExitCode . GenericFailure ) ;
37
37
}
38
38
39
+ [ InlineData ( TestingConstants . Debug ) ]
40
+ [ InlineData ( TestingConstants . Release ) ]
41
+ [ Theory ]
42
+ public void RunTestProjectWithWithRetryFeature_ShouldSucceed ( string configuration )
43
+ {
44
+ TestAsset testInstance = _testAssetsManager . CopyTestAsset ( "TestAppSimpleWithRetry" , Guid . NewGuid ( ) . ToString ( ) )
45
+ . WithSource ( ) ;
46
+
47
+ CommandResult result = new DotnetTestCommand ( Log , disableNewOutput : false )
48
+ . WithWorkingDirectory ( testInstance . Path )
49
+ . Execute ( TestingPlatformOptions . ConfigurationOption . Name , configuration ) ;
50
+
51
+ if ( ! TestContext . IsLocalized ( ) )
52
+ {
53
+ result . StdOut
54
+ . Should ( ) . Contain ( "Test run summary: Passed!" )
55
+ . And . Contain ( "total: 1" )
56
+ . And . Contain ( "succeeded: 1" )
57
+ . And . Contain ( "failed: 0" )
58
+ . And . Contain ( "skipped: 0" ) ;
59
+ }
60
+
61
+ result . ExitCode . Should ( ) . Be ( ExitCode . Success ) ;
62
+ }
63
+
39
64
[ InlineData ( TestingConstants . Debug ) ]
40
65
[ InlineData ( TestingConstants . Release ) ]
41
66
[ Theory ]
You can’t perform that action at this time.
0 commit comments