You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Given that I run test with retry attribute with the value of N and some of those times test fails, mixed results are returned to MSTest framework, and as the result test is marked as failed.
Steps to reproduce
Create test with retry attribute, with the value of 5
Fail test 4 times out of 5
Expected behavior
Test run is marked as successful
Actual behavior
Test run is not marked as successful
The text was updated successfully, but these errors were encountered:
From my point of view, the only question that is raised is what about test results with failed runs? I don't see any way keeping them and marking tests as passed at the same time.
Here I have a proposal - add an optional parameter on RetryAttribute. It will override failed test outcome if the maximum retry attempts is not reached. The default behavior is keep its failed test outcome.
using Microsoft.VisualStudio.TestTools.UnitTesting;
using MSTest.TestFramework.Extensions.AttributeEx;
using MSTest.TestFramework.Extensions.TestMethodEx;
namespace UnitTestProject1
{
[TestClass]
public class UnitTest1
{
[TestMethodEx]
[Retry(5)]
[Retry(5, UnitTestOutcome.Inconclusive)]
public void TestMethod1()
{
// Test logic that causes the test to fail.
}
}
}
Description
Steps to reproduce
Expected behavior
Actual behavior
The text was updated successfully, but these errors were encountered: