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

Enable tests on Release #5141

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 0 additions & 2 deletions test/IntegrationTests/MSTest.IntegrationTests/OutputTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ public class OutputTests : CLITestBase
{
private const string TestAssetName = "OutputTestProject";

#if DEBUG
public async Task OutputIsNotMixedWhenTestsRunInParallel() => await ValidateOutputForClassAsync("UnitTest1");
#endif

public async Task OutputIsNotMixedWhenAsyncTestsRunInParallel() => await ValidateOutputForClassAsync("UnitTest2");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,10 @@ public void RunAssemblyInitializeShouldThrowTestFailedExceptionOnAssertionFailur
Verify(
exception.Message
== "Assembly Initialization method Microsoft.VisualStudio.TestPlatform.MSTestAdapter.UnitTests.Execution.TestAssemblyInfoTests+DummyTestClass.AssemblyInitializeMethod threw exception. Microsoft.VisualStudio.TestTools.UnitTesting.AssertFailedException: Assert.Fail failed. Test failure. Aborting test execution.");
#if DEBUG

Verify(exception.StackTraceInformation!.ErrorStackTrace.StartsWith(
" at Microsoft.VisualStudio.TestPlatform.MSTestAdapter.UnitTests.Execution.TestAssemblyInfoTests.<>c.<RunAssemblyInitializeShouldThrowTestFailedExceptionOnAssertionFailure>", StringComparison.Ordinal));
#endif
" at Microsoft.VisualStudio.TestPlatform.MSTestAdapter.UnitTests.Execution.TestAssemblyInfoTests.<>c.<RunAssemblyInitializeShouldThrowTestFailedExceptionOnAssertionFailure>", StringComparison.Ordinal));

Verify(exception.InnerException!.GetType() == typeof(UTF.AssertFailedException));
}

Expand All @@ -165,10 +165,10 @@ public void RunAssemblyInitializeShouldThrowTestFailedExceptionWithInconclusiveO
Verify(
exception.Message
== "Assembly Initialization method Microsoft.VisualStudio.TestPlatform.MSTestAdapter.UnitTests.Execution.TestAssemblyInfoTests+DummyTestClass.AssemblyInitializeMethod threw exception. Microsoft.VisualStudio.TestTools.UnitTesting.AssertInconclusiveException: Assert.Inconclusive failed. Test Inconclusive. Aborting test execution.");
#if DEBUG

Verify(exception.StackTraceInformation!.ErrorStackTrace.StartsWith(
" at Microsoft.VisualStudio.TestPlatform.MSTestAdapter.UnitTests.Execution.TestAssemblyInfoTests.<>c.<RunAssemblyInitializeShouldThrowTestFailedExceptionWithInconclusiveOnAssertInconclusive>", StringComparison.Ordinal));
#endif

Verify(exception.InnerException!.GetType() == typeof(UTF.AssertInconclusiveException));
}

Expand All @@ -183,10 +183,10 @@ public void RunAssemblyInitializeShouldThrowTestFailedExceptionWithNonAssertExce
Verify(
exception.Message
== "Assembly Initialization method Microsoft.VisualStudio.TestPlatform.MSTestAdapter.UnitTests.Execution.TestAssemblyInfoTests+DummyTestClass.AssemblyInitializeMethod threw exception. System.ArgumentException: Some actualErrorMessage message. Aborting test execution.");
#if DEBUG

Verify(exception.StackTraceInformation!.ErrorStackTrace.StartsWith(
" at Microsoft.VisualStudio.TestPlatform.MSTestAdapter.UnitTests.Execution.TestAssemblyInfoTests.<>c.<RunAssemblyInitializeShouldThrowTestFailedExceptionWithNonAssertExceptions>", StringComparison.Ordinal));
#endif

Verify(exception.InnerException!.GetType() == typeof(ArgumentException));
Verify(exception.InnerException.InnerException!.GetType() == typeof(InvalidOperationException));
}
Expand All @@ -206,10 +206,10 @@ public void RunAssemblyInitializeShouldThrowTheInnerMostExceptionWhenThereAreMul
Verify(
exception.Message
== "Assembly Initialization method Microsoft.VisualStudio.TestPlatform.MSTestAdapter.UnitTests.Execution.TestAssemblyInfoTests+DummyTestClass.AssemblyInitializeMethod threw exception. System.InvalidOperationException: I fail.. Aborting test execution.");
#if DEBUG

Verify(exception.StackTraceInformation!.ErrorStackTrace.StartsWith(
" at Microsoft.VisualStudio.TestPlatform.MSTestAdapter.UnitTests.Execution.TestAssemblyInfoTests.FailingStaticHelper..cctor()", StringComparison.Ordinal));
#endif

Verify(exception.InnerException!.GetType() == typeof(InvalidOperationException));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,10 +339,10 @@ public void RunClassInitializeShouldThrowTestFailedExceptionOnBaseInitializeMeth
Verify(
exception.Message
== "Class Initialization method Microsoft.VisualStudio.TestPlatform.MSTestAdapter.UnitTests.Execution.TestClassInfoTests+DummyTestClass.InitBaseClassMethod threw exception. System.ArgumentException: Some exception message.");
#if DEBUG

Verify(exception.StackTraceInformation!.ErrorStackTrace.StartsWith(
" at Microsoft.VisualStudio.TestPlatform.MSTestAdapter.UnitTests.Execution.TestClassInfoTests.<>c.<RunClassInitializeShouldThrowTestFailedExceptionOnBaseInitializeMethodWithNonAssertExceptions>", StringComparison.Ordinal));
#endif

Verify(exception.InnerException!.GetType() == typeof(ArgumentException));
Verify(exception.InnerException.InnerException!.GetType() == typeof(InvalidOperationException));
}
Expand All @@ -359,10 +359,10 @@ public void RunClassInitializeShouldThrowTestFailedExceptionOnAssertionFailure()
Verify(
exception.Message
== "Class Initialization method Microsoft.VisualStudio.TestPlatform.MSTestAdapter.UnitTests.Execution.TestClassInfoTests+DummyTestClass.ClassInitializeMethod threw exception. Microsoft.VisualStudio.TestTools.UnitTesting.AssertFailedException: Assert.Fail failed. Test failure.");
#if DEBUG

Verify(exception.StackTraceInformation!.ErrorStackTrace.StartsWith(
" at Microsoft.VisualStudio.TestPlatform.MSTestAdapter.UnitTests.Execution.TestClassInfoTests.<>c.<RunClassInitializeShouldThrowTestFailedExceptionOnAssertionFailure>", StringComparison.Ordinal));
#endif

Verify(exception.InnerException!.GetType() == typeof(UTF.AssertFailedException));
}

Expand All @@ -378,10 +378,10 @@ public void RunClassInitializeShouldThrowTestFailedExceptionWithInconclusiveOnAs
Verify(
exception.Message
== "Class Initialization method Microsoft.VisualStudio.TestPlatform.MSTestAdapter.UnitTests.Execution.TestClassInfoTests+DummyTestClass.ClassInitializeMethod threw exception. Microsoft.VisualStudio.TestTools.UnitTesting.AssertInconclusiveException: Assert.Inconclusive failed. Test Inconclusive.");
#if DEBUG

Verify(exception.StackTraceInformation!.ErrorStackTrace.StartsWith(
" at Microsoft.VisualStudio.TestPlatform.MSTestAdapter.UnitTests.Execution.TestClassInfoTests.<>c.<RunClassInitializeShouldThrowTestFailedExceptionWithInconclusiveOnAssertInconclusive>", StringComparison.Ordinal));
#endif

Verify(exception.InnerException!.GetType() == typeof(UTF.AssertInconclusiveException));
}

Expand All @@ -397,10 +397,9 @@ public void RunClassInitializeShouldThrowTestFailedExceptionWithNonAssertExcepti
Verify(
exception.Message
== "Class Initialization method Microsoft.VisualStudio.TestPlatform.MSTestAdapter.UnitTests.Execution.TestClassInfoTests+DummyTestClass.ClassInitializeMethod threw exception. System.ArgumentException: Argument exception.");
#if DEBUG

Verify(exception.StackTraceInformation!.ErrorStackTrace.StartsWith(
" at Microsoft.VisualStudio.TestPlatform.MSTestAdapter.UnitTests.Execution.TestClassInfoTests.<>c.<RunClassInitializeShouldThrowTestFailedExceptionWithNonAssertExceptions>", StringComparison.Ordinal));
#endif
}

public void RunClassInitializeShouldThrowForAlreadyExecutedTestClassInitWithException()
Expand Down Expand Up @@ -439,11 +438,11 @@ public void RunClassInitializeShouldThrowTheInnerMostExceptionWhenThereAreMultip
Verify(
exception.Message
== "Class Initialization method Microsoft.VisualStudio.TestPlatform.MSTestAdapter.UnitTests.Execution.TestClassInfoTests+DummyTestClass.ClassInitializeMethod threw exception. System.InvalidOperationException: I fail..");
#if DEBUG

Verify(
exception.StackTraceInformation!.ErrorStackTrace.StartsWith(
" at Microsoft.VisualStudio.TestPlatform.MSTestAdapter.UnitTests.Execution.TestClassInfoTests.FailingStaticHelper..cctor()", StringComparison.Ordinal));
#endif

Verify(exception.InnerException!.GetType() == typeof(InvalidOperationException));
}

Expand Down Expand Up @@ -501,12 +500,11 @@ public void RunClassCleanupShouldReturnAssertFailureExceptionDetails()
Verify(classCleanupException is not null);
Verify(classCleanupException.Message.StartsWith("Class Cleanup method DummyTestClass.ClassCleanupMethod failed.", StringComparison.Ordinal));
Verify(classCleanupException.Message.Contains("Error Message: Assert.Fail failed. Test Failure."));
#if DEBUG

Verify(
classCleanupException.Message.Contains(
$"{typeof(TestClassInfoTests).FullName}.<>c.<{nameof(this.RunClassCleanupShouldReturnAssertFailureExceptionDetails)}>"),
$"Value: {classCleanupException.Message}");
#endif
}

public void RunClassCleanupShouldReturnAssertInconclusiveExceptionDetails()
Expand All @@ -523,11 +521,10 @@ public void RunClassCleanupShouldReturnAssertInconclusiveExceptionDetails()
Verify(classCleanupException is not null);
Verify(classCleanupException.Message.StartsWith("Class Cleanup method DummyTestClass.ClassCleanupMethod failed.", StringComparison.Ordinal));
Verify(classCleanupException.Message.Contains("Error Message: Assert.Inconclusive failed. Test Inconclusive."));
#if DEBUG

Verify(
classCleanupException.Message.Contains($"{typeof(TestClassInfoTests).FullName}.<>c.<{nameof(this.RunClassCleanupShouldReturnAssertInconclusiveExceptionDetails)}>"),
$"Value: {classCleanupException.Message}");
#endif
}

public void RunClassCleanupShouldReturnExceptionDetailsOfNonAssertExceptions()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -574,10 +574,9 @@ public void TestMethodInfoInvokeWhenTestThrowsReturnsExpectedResult()
Verify(exception.Outcome == UTF.UnitTestOutcome.Failed);
Verify(exception.InnerException!.GetType() == typeof(ArgumentException));
Verify(exception.InnerException.InnerException!.GetType() == typeof(InvalidOperationException));
#if DEBUG

Verify(exception.StackTraceInformation!.ErrorStackTrace.StartsWith(
" at Microsoft.VisualStudio.TestPlatform.MSTestAdapter.UnitTests.Execution.TestMethodInfoTests.<>c.<TestMethodInfoInvokeWhenTestThrowsReturnsExpectedResult>b__", StringComparison.Ordinal));
#endif
}

public void TestInitialize_WhenTestReturnsTaskFromException_DisplayProperException()
Expand Down Expand Up @@ -644,10 +643,9 @@ public void TestMethodInfoInvokeWhenTestThrowsAssertFailReturnsExpectedResult()
Verify(errorMessage == exception.Message);
Verify(exception.Outcome == UTF.UnitTestOutcome.Failed);
Verify(exception.InnerException!.GetType() == typeof(UTF.AssertFailedException));
#if DEBUG

Verify(exception.StackTraceInformation!.ErrorStackTrace.StartsWith(
" at Microsoft.VisualStudio.TestPlatform.MSTestAdapter.UnitTests.Execution.TestMethodInfoTests.<>c.<TestMethodInfoInvokeWhenTestThrowsAssertFailReturnsExpectedResult>b__", StringComparison.Ordinal));
#endif
}

public void TestMethodInfoInvokeWhenTestThrowsAssertInconclusiveReturnsExpectedResult()
Expand Down Expand Up @@ -680,10 +678,9 @@ public void TestMethodInfoInvokeWhenTestThrowsAssertInconclusiveReturnsExpectedR
Verify(errorMessage == exception.Message);
Verify(exception.Outcome == UTF.UnitTestOutcome.Inconclusive);
Verify(exception.InnerException!.GetType() == typeof(UTF.AssertInconclusiveException));
#if DEBUG

Verify(exception.StackTraceInformation!.ErrorStackTrace.StartsWith(
" at Microsoft.VisualStudio.TestPlatform.MSTestAdapter.UnitTests.Execution.TestMethodInfoTests.<>c.<TestMethodInfoInvokeWhenTestThrowsAssertInconclusiveReturnsExpectedResult>b__", StringComparison.Ordinal));
#endif
}

#endregion
Expand Down Expand Up @@ -830,10 +827,8 @@ public void TestMethodInfoInvokeWhenTestCleanupThrowsReturnsExpectedResult()
Verify(exception.InnerException!.GetType() == typeof(ArgumentException));
Verify(exception.InnerException.InnerException!.GetType() == typeof(InvalidOperationException));

#if DEBUG
Verify(exception.StackTraceInformation!.ErrorStackTrace.StartsWith(
" at Microsoft.VisualStudio.TestPlatform.MSTestAdapter.UnitTests.Execution.TestMethodInfoTests.<>c.<TestMethodInfoInvokeWhenTestCleanupThrowsReturnsExpectedResult>b__", StringComparison.Ordinal));
#endif
}

public void TestMethodInfoInvokeWhenTestCleanupThrowsAssertInconclusiveReturnsExpectedResult()
Expand All @@ -857,10 +852,9 @@ public void TestMethodInfoInvokeWhenTestCleanupThrowsAssertInconclusiveReturnsEx
Verify(exception.Outcome == UTF.UnitTestOutcome.Inconclusive);
Verify(expectedErrorMessage == exception.Message);
Verify(exception.InnerException!.GetType() == typeof(UTF.AssertInconclusiveException));
#if DEBUG

Verify(exception.StackTraceInformation!.ErrorStackTrace.StartsWith(
" at Microsoft.VisualStudio.TestPlatform.MSTestAdapter.UnitTests.Execution.TestMethodInfoTests.<>c.<TestMethodInfoInvokeWhenTestCleanupThrowsAssertInconclusiveReturnsExpectedResult>b__", StringComparison.Ordinal));
#endif
}

public void TestMethodInfoInvokeWhenTestCleanupThrowsAssertFailedReturnsExpectedResult()
Expand All @@ -884,10 +878,9 @@ public void TestMethodInfoInvokeWhenTestCleanupThrowsAssertFailedReturnsExpected
Verify(exception.Outcome == UTF.UnitTestOutcome.Failed);
Verify(expectedErrorMessage == exception.Message);
Verify(exception.InnerException!.GetType() == typeof(UTF.AssertFailedException));
#if DEBUG

Verify(exception.StackTraceInformation!.ErrorStackTrace.StartsWith(
" at Microsoft.VisualStudio.TestPlatform.MSTestAdapter.UnitTests.Execution.TestMethodInfoTests.<>c.<TestMethodInfoInvokeWhenTestCleanupThrowsAssertFailedReturnsExpectedResult>b__", StringComparison.Ordinal));
#endif
}

public void TestMethodInfoInvokeShouldAppendErrorMessagesIfBothTestMethodAndTestCleanupThrows()
Expand Down Expand Up @@ -927,11 +920,10 @@ public void TestMethodInfoInvokeShouldAppendStackTraceInformationIfBothTestMetho

Verify(result.Outcome == UTF.UnitTestOutcome.Failed);
Verify(exception is not null);
#if DEBUG

Verify(exception.StackTraceInformation!.ErrorStackTrace.Contains("Microsoft.VisualStudio.TestPlatform.MSTestAdapter.UnitTests.Execution.TestMethodInfoTests.DummyTestClass.DummyTestMethod()"));
Verify(exception.StackTraceInformation.ErrorStackTrace.Contains(Resource.UTA_CleanupStackTrace));
Verify(exception.StackTraceInformation.ErrorStackTrace.Contains("Microsoft.VisualStudio.TestPlatform.MSTestAdapter.UnitTests.Execution.TestMethodInfoTests.DummyTestClass.DummyTestCleanupMethod()"));
#endif
}

public void TestMethodInfoInvokeShouldSetOutcomeAsInconclusiveIfTestCleanupIsInconclusive()
Expand Down
2 changes: 0 additions & 2 deletions test/Utilities/Automation.CLI/CLITestBase.e2e.cs
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,6 @@ public void ValidateFailedTestsContain(bool validateStackTraceInfo, params strin
test.Equals(f.DisplayName, StringComparison.Ordinal));
testFound.Should().NotBeNull("Test '{0}' does not appear in failed tests list.", test);

#if DEBUG
if (!validateStackTraceInfo)
{
continue;
Expand All @@ -261,7 +260,6 @@ public void ValidateFailedTestsContain(bool validateStackTraceInfo, params strin
{
testFound.ErrorStackTrace.Should().Contain(testMethodName, "No stack trace for failed test: {0}", test);
}
#endif
}
}

Expand Down
Loading