Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add instance id to protocol with MTP #47764

Merged
merged 20 commits into from
Mar 22, 2025
Merged
Changes from 1 commit
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
Next Next commit
Add test for MTP Retry feature
Youssef1313 committed Mar 19, 2025

Partially verified

This commit is signed with the committer’s verified signature.
BrewTestBot’s contribution has been verified via GPG key.
We cannot verify signatures from co-authors, and some of the co-authors attributed to this commit require their commits to be signed.
commit 38db961d5750e542bab260bc7f9c72a6bc4c8c78
4 changes: 0 additions & 4 deletions eng/Versions.props
Original file line number Diff line number Diff line change
@@ -174,10 +174,6 @@
<MicrosoftTestPlatformCLIPackageVersion>17.14.0-preview-25157-01</MicrosoftTestPlatformCLIPackageVersion>
<MicrosoftTestPlatformBuildPackageVersion>17.14.0-preview-25157-01</MicrosoftTestPlatformBuildPackageVersion>
</PropertyGroup>
<PropertyGroup>
<!-- Dependencies from https://github.com/Microsoft/testfx -->
<MicrosoftTestingPlatformVersion>1.5.0-preview.24602.2</MicrosoftTestingPlatformVersion>
</PropertyGroup>
<PropertyGroup>
<!-- Dependencies from https://github.com/dotnet/roslyn-analyzers -->
<MicrosoftCodeAnalysisNetAnalyzersVersion>10.0.0-preview.25155.1</MicrosoftCodeAnalysisNetAnalyzersVersion>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), testAsset.props))\testAsset.props" />

<PropertyGroup>
<TargetFramework>$(CurrentTargetFramework)</TargetFramework>
<OutputType>Exe</OutputType>
<TestingPlatformCommandLineArguments>$(TestingPlatformCommandLineArguments) --retry-failed-tests 3</TestingPlatformCommandLineArguments>
<EnableMSTestRunner>true</EnableMSTestRunner>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="MSTest" Version="$(MSTestVersion)" />
<PackageReference Include="Microsoft.Testing.Extensions.Retry" Version="$(MicrosoftTestingPlatformVersion)" />
</ItemGroup>
</Project>
19 changes: 19 additions & 0 deletions test/TestAssets/TestProjects/TestAppSimpleWithRetry/TestClass1.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;

[TestClass]
public class TestClass1
{
[TestMethod]
public void TestMethod1()
{
if (Environment.GetCommandLineArgs().Any(arg => arg.Contains("Retries") && !arg.EndsWith("2")))
{
Assert.Fail("Failing...");
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[dotnet.test:runner]
name= "Microsoft.Testing.Platform"
25 changes: 25 additions & 0 deletions test/dotnet-test.Tests/GivenDotnetTestBuildsAndRunsTests.cs
Original file line number Diff line number Diff line change
@@ -36,6 +36,31 @@ public void RunTestProjectWithNoTests_ShouldReturnExitCodeGenericFailure(string
result.ExitCode.Should().Be(ExitCode.GenericFailure);
}

[InlineData(TestingConstants.Debug)]
[InlineData(TestingConstants.Release)]
[Theory]
public void RunTestProjectWithWithRetryFeature_ShouldSucceed(string configuration)
{
TestAsset testInstance = _testAssetsManager.CopyTestAsset("TestAppSimpleWithRetry", Guid.NewGuid().ToString())
.WithSource();

CommandResult result = new DotnetTestCommand(Log, disableNewOutput: false)
.WithWorkingDirectory(testInstance.Path)
.Execute(TestingPlatformOptions.ConfigurationOption.Name, configuration);

if (!TestContext.IsLocalized())
{
result.StdOut
.Should().Contain("Test run summary: Passed!")
.And.Contain("total: 1")
.And.Contain("succeeded: 1")
.And.Contain("failed: 0")
.And.Contain("skipped: 0");
}

result.ExitCode.Should().Be(ExitCode.Success);
}

[InlineData(TestingConstants.Debug)]
[InlineData(TestingConstants.Release)]
[Theory]