diff --git a/src/Adapter/MSTest.TestAdapter/Execution/TestClassInfo.cs b/src/Adapter/MSTest.TestAdapter/Execution/TestClassInfo.cs
index f5f444bd8d..5480c83fac 100644
--- a/src/Adapter/MSTest.TestAdapter/Execution/TestClassInfo.cs
+++ b/src/Adapter/MSTest.TestAdapter/Execution/TestClassInfo.cs
@@ -330,7 +330,7 @@ public void RunClassInitialize(TestContext testContext)
///
/// Any exception that can be thrown as part of a class cleanup as warning messages.
///
- public string? RunClassCleanup(ClassCleanupBehavior classCleanupLifecycle = ClassCleanupBehavior.EndOfAssembly)
+ public string? RunClassCleanup(ClassCleanupBehavior classCleanupLifecycle = ClassCleanupBehavior.EndOfClass)
{
if (ClassCleanupMethod is null && BaseClassInitAndCleanupMethods.All(p => p.Item2 == null))
{
diff --git a/src/Adapter/MSTest.TestAdapter/Execution/UnitTestRunner.cs b/src/Adapter/MSTest.TestAdapter/Execution/UnitTestRunner.cs
index 8e53db7412..b08e570de5 100644
--- a/src/Adapter/MSTest.TestAdapter/Execution/UnitTestRunner.cs
+++ b/src/Adapter/MSTest.TestAdapter/Execution/UnitTestRunner.cs
@@ -90,7 +90,7 @@ internal void InitializeClassCleanupManager(ICollection testsTo
{
// We can't transport the Enum across AppDomain boundaries because of backwards and forwards compatibility.
// So we're converting here if we can, or falling back to the default.
- var lifecycle = ClassCleanupBehavior.EndOfAssembly;
+ var lifecycle = ClassCleanupBehavior.EndOfClass;
if (classCleanupLifecycle != null && Enum.IsDefined(typeof(ClassCleanupBehavior), classCleanupLifecycle))
{
lifecycle = (ClassCleanupBehavior)classCleanupLifecycle;
diff --git a/src/Adapter/MSTest.TestAdapter/PublicAPI/PublicAPI.Shipped.txt b/src/Adapter/MSTest.TestAdapter/PublicAPI/PublicAPI.Shipped.txt
index d83434a5ad..896f3e561d 100644
--- a/src/Adapter/MSTest.TestAdapter/PublicAPI/PublicAPI.Shipped.txt
+++ b/src/Adapter/MSTest.TestAdapter/PublicAPI/PublicAPI.Shipped.txt
@@ -38,7 +38,7 @@ Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.TestClassInfo.H
Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.TestClassInfo.IsClassCleanupExecuted.get -> bool
Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.TestClassInfo.IsClassInitializeExecuted.get -> bool
Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.TestClassInfo.Parent.get -> Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.TestAssemblyInfo!
-Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.TestClassInfo.RunClassCleanup(Microsoft.VisualStudio.TestTools.UnitTesting.ClassCleanupBehavior classCleanupLifecycle = Microsoft.VisualStudio.TestTools.UnitTesting.ClassCleanupBehavior.EndOfAssembly) -> string?
+Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.TestClassInfo.RunClassCleanup(Microsoft.VisualStudio.TestTools.UnitTesting.ClassCleanupBehavior classCleanupLifecycle = Microsoft.VisualStudio.TestTools.UnitTesting.ClassCleanupBehavior.EndOfClass) -> string?
Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.TestClassInfo.RunClassInitialize(Microsoft.VisualStudio.TestTools.UnitTesting.TestContext! testContext) -> void
Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.TestClassInfo.TestCleanupMethod.get -> System.Reflection.MethodInfo?
Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.TestClassInfo.TestContextProperty.get -> System.Reflection.PropertyInfo?
diff --git a/src/Adapter/MSTest.TestAdapter/PublicAPI/PublicAPI.Unshipped.txt b/src/Adapter/MSTest.TestAdapter/PublicAPI/PublicAPI.Unshipped.txt
index ab058de62d..91b0e1a43b 100644
--- a/src/Adapter/MSTest.TestAdapter/PublicAPI/PublicAPI.Unshipped.txt
+++ b/src/Adapter/MSTest.TestAdapter/PublicAPI/PublicAPI.Unshipped.txt
@@ -1 +1 @@
-#nullable enable
+#nullable enable
\ No newline at end of file
diff --git a/src/TestFramework/TestFramework/Attributes/Lifecycle/Cleanup/ClassCleanupBehavior.cs b/src/TestFramework/TestFramework/Attributes/Lifecycle/Cleanup/ClassCleanupBehavior.cs
index 7f829f43ef..a39e837b4f 100644
--- a/src/TestFramework/TestFramework/Attributes/Lifecycle/Cleanup/ClassCleanupBehavior.cs
+++ b/src/TestFramework/TestFramework/Attributes/Lifecycle/Cleanup/ClassCleanupBehavior.cs
@@ -9,12 +9,12 @@ namespace Microsoft.VisualStudio.TestTools.UnitTesting;
public enum ClassCleanupBehavior
{
///
- /// Run at end of assembly.
+ /// Run at end of class.
///
- EndOfAssembly,
+ EndOfClass,
///
- /// Run at end of class.
+ /// Run at end of assembly.
///
- EndOfClass,
+ EndOfAssembly,
}
diff --git a/src/TestFramework/TestFramework/Attributes/Lifecycle/Cleanup/ClassCleanupExecutionAttribute.cs b/src/TestFramework/TestFramework/Attributes/Lifecycle/Cleanup/ClassCleanupExecutionAttribute.cs
index 1387c67564..1da0df830d 100644
--- a/src/TestFramework/TestFramework/Attributes/Lifecycle/Cleanup/ClassCleanupExecutionAttribute.cs
+++ b/src/TestFramework/TestFramework/Attributes/Lifecycle/Cleanup/ClassCleanupExecutionAttribute.cs
@@ -11,16 +11,11 @@ namespace Microsoft.VisualStudio.TestTools.UnitTesting;
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false, Inherited = true)]
public class ClassCleanupExecutionAttribute : Attribute
{
- ///
- /// Default class cleanup execution.
- ///
- public static readonly ClassCleanupBehavior DefaultClassCleanupLifecycle = ClassCleanupBehavior.EndOfAssembly;
-
///
/// Initializes a new instance of the class.
///
public ClassCleanupExecutionAttribute()
- : this(DefaultClassCleanupLifecycle)
+ : this(ClassCleanupBehavior.EndOfClass)
{
}
diff --git a/src/TestFramework/TestFramework/PublicAPI/PublicAPI.Shipped.txt b/src/TestFramework/TestFramework/PublicAPI/PublicAPI.Shipped.txt
index 2d2feb3767..cd4707d305 100644
--- a/src/TestFramework/TestFramework/PublicAPI/PublicAPI.Shipped.txt
+++ b/src/TestFramework/TestFramework/PublicAPI/PublicAPI.Shipped.txt
@@ -22,8 +22,8 @@ Microsoft.VisualStudio.TestTools.UnitTesting.ClassCleanupAttribute.ClassCleanupA
Microsoft.VisualStudio.TestTools.UnitTesting.ClassCleanupAttribute.CleanupBehavior.get -> Microsoft.VisualStudio.TestTools.UnitTesting.ClassCleanupBehavior?
Microsoft.VisualStudio.TestTools.UnitTesting.ClassCleanupAttribute.InheritanceBehavior.get -> Microsoft.VisualStudio.TestTools.UnitTesting.InheritanceBehavior
Microsoft.VisualStudio.TestTools.UnitTesting.ClassCleanupBehavior
-Microsoft.VisualStudio.TestTools.UnitTesting.ClassCleanupBehavior.EndOfAssembly = 0 -> Microsoft.VisualStudio.TestTools.UnitTesting.ClassCleanupBehavior
-Microsoft.VisualStudio.TestTools.UnitTesting.ClassCleanupBehavior.EndOfClass = 1 -> Microsoft.VisualStudio.TestTools.UnitTesting.ClassCleanupBehavior
+Microsoft.VisualStudio.TestTools.UnitTesting.ClassCleanupBehavior.EndOfAssembly = 1 -> Microsoft.VisualStudio.TestTools.UnitTesting.ClassCleanupBehavior
+Microsoft.VisualStudio.TestTools.UnitTesting.ClassCleanupBehavior.EndOfClass = 0 -> Microsoft.VisualStudio.TestTools.UnitTesting.ClassCleanupBehavior
Microsoft.VisualStudio.TestTools.UnitTesting.ClassCleanupExecutionAttribute
Microsoft.VisualStudio.TestTools.UnitTesting.ClassCleanupExecutionAttribute.ClassCleanupExecutionAttribute() -> void
Microsoft.VisualStudio.TestTools.UnitTesting.ClassCleanupExecutionAttribute.ClassCleanupExecutionAttribute(Microsoft.VisualStudio.TestTools.UnitTesting.ClassCleanupBehavior cleanupBehavior) -> void
@@ -326,7 +326,6 @@ static Microsoft.VisualStudio.TestTools.UnitTesting.CollectionAssert.That.get ->
static Microsoft.VisualStudio.TestTools.UnitTesting.Logging.Logger.LogMessage(string! format, params object?[]! args) -> void
static Microsoft.VisualStudio.TestTools.UnitTesting.Logging.Logger.OnLogMessage -> Microsoft.VisualStudio.TestTools.UnitTesting.Logging.Logger.LogMessageHandler?
static Microsoft.VisualStudio.TestTools.UnitTesting.StringAssert.That.get -> Microsoft.VisualStudio.TestTools.UnitTesting.StringAssert!
-static readonly Microsoft.VisualStudio.TestTools.UnitTesting.ClassCleanupExecutionAttribute.DefaultClassCleanupLifecycle -> Microsoft.VisualStudio.TestTools.UnitTesting.ClassCleanupBehavior
static readonly Microsoft.VisualStudio.TestTools.UnitTesting.DataSourceAttribute.DefaultDataAccessMethod -> Microsoft.VisualStudio.TestTools.UnitTesting.DataAccessMethod
static readonly Microsoft.VisualStudio.TestTools.UnitTesting.DataSourceAttribute.DefaultProviderName -> string!
virtual Microsoft.VisualStudio.TestTools.UnitTesting.DataRowAttribute.GetDisplayName(System.Reflection.MethodInfo! methodInfo, object?[]? data) -> string?
diff --git a/test/IntegrationTests/MSTest.VstestConsoleWrapper.IntegrationTests/SuiteLifeCycleTests.cs b/test/IntegrationTests/MSTest.VstestConsoleWrapper.IntegrationTests/SuiteLifeCycleTests.cs
index 41a3f506c2..bdeaff0280 100644
--- a/test/IntegrationTests/MSTest.VstestConsoleWrapper.IntegrationTests/SuiteLifeCycleTests.cs
+++ b/test/IntegrationTests/MSTest.VstestConsoleWrapper.IntegrationTests/SuiteLifeCycleTests.cs
@@ -153,6 +153,7 @@ private void ValidateTestRunLifecycle(string targetFramework)
targetFramework: targetFramework);
RunEventsHandler.PassedTests.Should().HaveCount(27); // The inherit class tests are called twice.
+ // The cleanup will appear in this case as the default ClassCleanup is EndOfClass.
var caseClassCleanup = RunEventsHandler.PassedTests.Single(x => x.TestCase.FullyQualifiedName.Contains("LifeCycleClassCleanup.TestMethod"));
caseClassCleanup.Outcome.Should().Be(Microsoft.VisualStudio.TestPlatform.ObjectModel.TestOutcome.Passed);
caseClassCleanup.Messages.Should().HaveCount(3);
@@ -167,6 +168,7 @@ private void ValidateTestRunLifecycle(string targetFramework)
{(targetFramework == "net6.0"
? "Console: LifeCycleClassCleanup.DisposeAsync was called\r\nConsole: LifeCycleClassCleanup.Dispose was called"
: "Console: LifeCycleClassCleanup.Dispose was called")}
+ Console: LifeCycleClassCleanup.ClassCleanup was called
""");
caseClassCleanup.Messages[1].Text.Should().Be(
@@ -185,7 +187,8 @@ private void ValidateTestRunLifecycle(string targetFramework)
+ "\r\n"
+ GenerateTraceDebugPrefixedMessage("LifeCycleClassCleanup.Dispose was called")
: GenerateTraceDebugPrefixedMessage("LifeCycleClassCleanup.Dispose was called"))}
-
+ {GenerateTraceDebugPrefixedMessage("LifeCycleClassCleanup.ClassCleanup was called")}
+
""");
caseClassCleanup.Messages[2].Text.Should().Be(
$"""
@@ -201,6 +204,7 @@ LifeCycleClassCleanup.TestCleanup was called
{(targetFramework == "net6.0"
? "LifeCycleClassCleanup.DisposeAsync was called\r\nLifeCycleClassCleanup.Dispose was called"
: "LifeCycleClassCleanup.Dispose was called")}
+ LifeCycleClassCleanup.ClassCleanup was called
""");
@@ -1568,7 +1572,6 @@ LifeCycleClassCleanupEndOfClassAndNone.TestCleanup was called
var expectedRemainingMessages =
"""
Console: LifeCycleDerivedClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.ClassCleanup was called
- Console: LifeCycleClassCleanup.ClassCleanup was called
Console: LifeCycleClassCleanupEndOfAssemblyAndBeforeEachDerivedClass.ClassCleanup was called
Console: LifeCycleClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.ClassCleanup was called
Console: LifeCycleDerivedClassCleanupEndOfAssemblyAndNone.ClassCleanup was called
@@ -1624,7 +1627,6 @@ LifeCycleClassCleanupEndOfClassAndNone.TestCleanup was called
{GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeAndCleanupNone.ClassCleanup was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleClassCleanupEndOfAssemblyAndNone.ClassCleanup was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleDerivedClassInitializeBeforeEachDerivedClassAndClassCleanupNone.ClassCleanup was called")}
- {GenerateTraceDebugPrefixedMessage("LifeCycleClassCleanup.ClassCleanup was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleDerivedClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.ClassCleanup was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.ClassCleanup was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleDerivedClassInitializeAndCleanupNone.ClassCleanup was called")}
@@ -1676,7 +1678,6 @@ LifeCycleDerivedClassCleanupEndOfClassAndBeforeEachDerivedClass.ClassCleanup was
LifeCycleDerivedClassCleanupEndOfAssemblyAndBeforeEachDerivedClass.ClassCleanup was called
LifeCycleDerivedClassCleanupEndOfClassAndNone.ClassCleanup was called
LifeCycleClassCleanupEndOfAssemblyAndNone.ClassCleanup was called
- LifeCycleClassCleanup.ClassCleanup was called
LifeCycleClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.ClassCleanup was called
LifeCycleDerivedClassInitializeAndCleanupNone.ClassCleanup was called
LifeCycleClassInitializeAndCleanupNone.ClassCleanup was called
diff --git a/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.cs b/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.cs
index 3182b45aef..2c1b5bd694 100644
--- a/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.cs
+++ b/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.cs
@@ -87,7 +87,7 @@ public ValueTask DisposeAsync()
}
#endif
- [ClassCleanup(InheritanceBehavior.BeforeEachDerivedClass)]
+ [ClassCleanup(InheritanceBehavior.BeforeEachDerivedClass, ClassCleanupBehavior.EndOfAssembly)]
public static void ClassCleanup()
{
s_testContext.WriteLine("LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.ClassCleanup was called");
diff --git a/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleClassInitializeAndCleanupNone.cs b/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleClassInitializeAndCleanupNone.cs
index 888c57a8f6..4f7b807570 100644
--- a/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleClassInitializeAndCleanupNone.cs
+++ b/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleClassInitializeAndCleanupNone.cs
@@ -87,7 +87,7 @@ public ValueTask DisposeAsync()
}
#endif
- [ClassCleanup(InheritanceBehavior.None)]
+ [ClassCleanup(InheritanceBehavior.None, ClassCleanupBehavior.EndOfAssembly)]
public static void ClassCleanup()
{
s_testContext.WriteLine("LifeCycleClassInitializeAndCleanupNone.ClassCleanup was called");
diff --git a/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.cs b/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.cs
index b1a5d179c5..19db618a9e 100644
--- a/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.cs
+++ b/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.cs
@@ -87,7 +87,7 @@ public ValueTask DisposeAsync()
}
#endif
- [ClassCleanup(InheritanceBehavior.None)]
+ [ClassCleanup(InheritanceBehavior.None, ClassCleanupBehavior.EndOfAssembly)]
public static void ClassCleanup()
{
s_testContext.WriteLine("LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.ClassCleanup was called");
diff --git a/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.cs b/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.cs
index be38a76fe6..8122f204d2 100644
--- a/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.cs
+++ b/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.cs
@@ -87,7 +87,7 @@ public ValueTask DisposeAsync()
}
#endif
- [ClassCleanup(InheritanceBehavior.BeforeEachDerivedClass)]
+ [ClassCleanup(InheritanceBehavior.BeforeEachDerivedClass, ClassCleanupBehavior.EndOfAssembly)]
public static void ClassCleanup()
{
s_testContext.WriteLine("LifeCycleClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.ClassCleanup was called");
diff --git a/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleDerivedClassCleanupEndOfAssemblyAndBeforeEachDerivedClass.cs b/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleDerivedClassCleanupEndOfAssemblyAndBeforeEachDerivedClass.cs
index d836891284..cd544c7406 100644
--- a/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleDerivedClassCleanupEndOfAssemblyAndBeforeEachDerivedClass.cs
+++ b/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleDerivedClassCleanupEndOfAssemblyAndBeforeEachDerivedClass.cs
@@ -60,7 +60,7 @@ public void DerivedClassTestCleanup()
Debug.WriteLine("Debug: LifeCycleDerivedClassCleanupEndOfAssemblyAndBeforeEachDerivedClass.TestCleanup was called");
}
- [ClassCleanup]
+ [ClassCleanup(ClassCleanupBehavior.EndOfAssembly)]
public static void DerivedClassCleanup()
{
s_testContext.WriteLine("LifeCycleDerivedClassCleanupEndOfAssemblyAndBeforeEachDerivedClass.ClassCleanup was called");
diff --git a/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleDerivedClassCleanupEndOfAssemblyAndNone.cs b/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleDerivedClassCleanupEndOfAssemblyAndNone.cs
index 62b95bab86..a7c27e8b04 100644
--- a/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleDerivedClassCleanupEndOfAssemblyAndNone.cs
+++ b/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleDerivedClassCleanupEndOfAssemblyAndNone.cs
@@ -60,7 +60,7 @@ public void DerivedClassTestCleanup()
Debug.WriteLine("Debug: LifeCycleDerivedClassCleanupEndOfAssemblyAndNone.TestCleanup was called");
}
- [ClassCleanup]
+ [ClassCleanup(ClassCleanupBehavior.EndOfAssembly)]
public static void DerivedClassCleanup()
{
s_testContext.WriteLine("LifeCycleDerivedClassCleanupEndOfAssemblyAndNone.ClassCleanup was called");
diff --git a/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleDerivedClassCleanupEndOfClassAndBeforeEachDerivedClass.cs b/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleDerivedClassCleanupEndOfClassAndBeforeEachDerivedClass.cs
index b03078b4e9..849463af7b 100644
--- a/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleDerivedClassCleanupEndOfClassAndBeforeEachDerivedClass.cs
+++ b/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleDerivedClassCleanupEndOfClassAndBeforeEachDerivedClass.cs
@@ -60,7 +60,7 @@ public void DerivedClassTestCleanup()
Debug.WriteLine("Debug: LifeCycleDerivedClassCleanupEndOfClassAndBeforeEachDerivedClass.TestCleanup was called");
}
- [ClassCleanup]
+ [ClassCleanup(ClassCleanupBehavior.EndOfAssembly)]
public static void DerivedClassCleanup()
{
s_testContext.WriteLine("LifeCycleDerivedClassCleanupEndOfClassAndBeforeEachDerivedClass.ClassCleanup was called");
diff --git a/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleDerivedClassCleanupEndOfClassAndNone.cs b/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleDerivedClassCleanupEndOfClassAndNone.cs
index 2e0be93a90..0e0cc9b262 100644
--- a/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleDerivedClassCleanupEndOfClassAndNone.cs
+++ b/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleDerivedClassCleanupEndOfClassAndNone.cs
@@ -60,7 +60,7 @@ public void DerivedClassTestCleanup()
Debug.WriteLine("Debug: LifeCycleDerivedClassCleanupEndOfClassAndNone.TestCleanup was called");
}
- [ClassCleanup]
+ [ClassCleanup(ClassCleanupBehavior.EndOfAssembly)]
public static void DerivedClassCleanup()
{
s_testContext.WriteLine("LifeCycleDerivedClassCleanupEndOfClassAndNone.ClassCleanup was called");
diff --git a/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleDerivedClassInitializeAndCleanupBeforeEachDerivedClass.cs b/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleDerivedClassInitializeAndCleanupBeforeEachDerivedClass.cs
index 80272222e8..ebf932e828 100644
--- a/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleDerivedClassInitializeAndCleanupBeforeEachDerivedClass.cs
+++ b/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleDerivedClassInitializeAndCleanupBeforeEachDerivedClass.cs
@@ -60,7 +60,7 @@ public void DerivedClassTestCleanup()
Debug.WriteLine("Debug: LifeCycleDerivedClassInitializeAndCleanupBeforeEachDerivedClass.TestCleanup was called");
}
- [ClassCleanup]
+ [ClassCleanup(ClassCleanupBehavior.EndOfAssembly)]
public static void DerivedClassCleanup()
{
s_testContext.WriteLine("LifeCycleDerivedClassInitializeAndCleanupBeforeEachDerivedClass.ClassCleanup was called");
diff --git a/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleDerivedClassInitializeAndCleanupNone.cs b/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleDerivedClassInitializeAndCleanupNone.cs
index fbfcdbe06b..54b9788c65 100644
--- a/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleDerivedClassInitializeAndCleanupNone.cs
+++ b/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleDerivedClassInitializeAndCleanupNone.cs
@@ -60,7 +60,7 @@ public void DerivedClassTestCleanup()
Debug.WriteLine("Debug: LifeCycleDerivedClassInitializeAndCleanupNone.TestCleanup was called");
}
- [ClassCleanup]
+ [ClassCleanup(ClassCleanupBehavior.EndOfAssembly)]
public static void DerivedClassCleanup()
{
s_testContext.WriteLine("LifeCycleDerivedClassInitializeAndCleanupNone.ClassCleanup was called");
diff --git a/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleDerivedClassInitializeBeforeEachDerivedClassAndClassCleanupNone.cs b/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleDerivedClassInitializeBeforeEachDerivedClassAndClassCleanupNone.cs
index 53c7479a06..22829e6324 100644
--- a/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleDerivedClassInitializeBeforeEachDerivedClassAndClassCleanupNone.cs
+++ b/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleDerivedClassInitializeBeforeEachDerivedClassAndClassCleanupNone.cs
@@ -61,7 +61,7 @@ public void DerivedClassTestCleanup()
Debug.WriteLine("Debug: LifeCycleDerivedClassInitializeBeforeEachDerivedClassAndClassCleanupNone.TestCleanup was called");
}
- [ClassCleanup]
+ [ClassCleanup(ClassCleanupBehavior.EndOfAssembly)]
public static void DerivedClassCleanup()
{
s_testContext.WriteLine("LifeCycleDerivedClassInitializeBeforeEachDerivedClassAndClassCleanupNone.ClassCleanup was called");
diff --git a/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleDerivedClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.cs b/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleDerivedClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.cs
index ef1d52805c..31c6fcbdff 100644
--- a/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleDerivedClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.cs
+++ b/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleDerivedClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.cs
@@ -61,7 +61,7 @@ public void DerivedClassTestCleanup()
Debug.WriteLine("Debug: LifeCycleDerivedClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.TestCleanup was called");
}
- [ClassCleanup]
+ [ClassCleanup(ClassCleanupBehavior.EndOfAssembly)]
public static void DerivedClassCleanup()
{
s_testContext.WriteLine("LifeCycleDerivedClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.ClassCleanup was called");
diff --git a/test/UnitTests/MSTestAdapter.UnitTests/Execution/TestClassInfoTests.cs b/test/UnitTests/MSTestAdapter.UnitTests/Execution/TestClassInfoTests.cs
index 64097fd886..8fe12a2b8d 100644
--- a/test/UnitTests/MSTestAdapter.UnitTests/Execution/TestClassInfoTests.cs
+++ b/test/UnitTests/MSTestAdapter.UnitTests/Execution/TestClassInfoTests.cs
@@ -491,7 +491,7 @@ public void RunClassCleanupShouldReturnAssertFailureExceptionDetails()
_testClassInfo.ClassCleanupMethod = typeof(DummyTestClass).GetMethod(nameof(DummyTestClass.ClassCleanupMethod));
// Act
- var classCleanup = _testClassInfo.RunClassCleanup();
+ var classCleanup = _testClassInfo.RunClassCleanup(UTF.ClassCleanupBehavior.EndOfAssembly);
// Assert
Verify(classCleanup.StartsWith("Class Cleanup method DummyTestClass.ClassCleanupMethod failed."));
@@ -506,7 +506,7 @@ public void RunClassCleanupShouldReturnAssertInconclusiveExceptionDetails()
_testClassInfo.ClassCleanupMethod = typeof(DummyTestClass).GetMethod(nameof(DummyTestClass.ClassCleanupMethod));
// Act
- var classCleanup = _testClassInfo.RunClassCleanup();
+ var classCleanup = _testClassInfo.RunClassCleanup(UTF.ClassCleanupBehavior.EndOfAssembly);
// Assert
Verify(classCleanup.StartsWith("Class Cleanup method DummyTestClass.ClassCleanupMethod failed."));
@@ -521,7 +521,7 @@ public void RunClassCleanupShouldReturnExceptionDetailsOfNonAssertExceptions()
_testClassInfo.ClassCleanupMethod = typeof(DummyTestClass).GetMethod(nameof(DummyTestClass.ClassCleanupMethod));
// Act
- var classCleanup = _testClassInfo.RunClassCleanup();
+ var classCleanup = _testClassInfo.RunClassCleanup(UTF.ClassCleanupBehavior.EndOfAssembly);
// Assert
Verify(classCleanup.StartsWith("Class Cleanup method DummyTestClass.ClassCleanupMethod failed."));
@@ -539,7 +539,7 @@ public void RunBaseClassCleanupWithNoDerivedClassCleanupShouldReturnExceptionDet
_testClassInfo.BaseClassCleanupMethodsStack.Push(baseClassCleanupMethod);
// Act
- var classCleanup = _testClassInfo.RunClassCleanup();
+ var classCleanup = _testClassInfo.RunClassCleanup(UTF.ClassCleanupBehavior.EndOfAssembly);
// Assert
Verify(classCleanup.StartsWith("Class Cleanup method DummyBaseTestClass.CleanupClassMethod failed."));