-
Notifications
You must be signed in to change notification settings - Fork 291
Labels
Area: FixturesArea: MSTestIssues with MSTest that are not specific to more refined area (e.g. analyzers or assertions)Issues with MSTest that are not specific to more refined area (e.g. analyzers or assertions)
Description
In Playground, I have:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
#pragma warning disable VSTHRD200 // Use "Async" suffix for async methods
using Microsoft.VisualStudio.TestTools.UnitTesting;
[assembly: Parallelize(Scope = ExecutionScope.MethodLevel, Workers = 0)]
namespace Playground;
[TestClass]
public class TestClass
{
[TestMethod]
[DynamicData(nameof(Data))]
public void Test3(int a, int b)
{
}
[TestInitialize]
public void TestInitialize()
{
// Initialization code here
}
[TestCleanup]
public void TestCleanup()
{
// Cleanup code here
}
[ClassInitialize]
public static void ClassInitialize(TestContext _)
{
// Class-level initialization code here
}
[ClassCleanup(ClassCleanupBehavior.EndOfClass)]
public static void ClassCleanup()
{
// Class-level cleanup code here
}
[AssemblyInitialize]
public static void AssemblyInitialize(TestContext _)
{
// Assembly-level initialization code here
}
[AssemblyCleanup]
public static void AssemblyCleanup()
{
// Assembly-level cleanup code here
}
public static IEnumerable<(int A, int B)> Data
{
get
{
yield return (1, 2);
yield return (3, 4);
}
}
}
[TestClass]
public class TestClass2
{
[TestMethod]
[DynamicData(nameof(Data))]
public void Test3(int a, int b)
{
}
[TestInitialize]
public void TestInitialize()
{
// Initialization code here
}
[TestCleanup]
public void TestCleanup()
{
// Cleanup code here
}
[ClassInitialize]
public static void ClassInitialize(TestContext _)
{
}
[ClassCleanup(ClassCleanupBehavior.EndOfClass)]
public static void ClassCleanup()
{
throw new Exception("TestClass2.ClassCleanup failed");
}
public static IEnumerable<(int A, int B)> Data
{
get
{
yield return (1, 2);
yield return (3, 4);
}
}
}If I enable ConsiderFixturesAsSpecialTests and try to run the tests in Playground, I get this:
The class cleanup failure isn't associated to the right node.
Metadata
Metadata
Assignees
Labels
Area: FixturesArea: MSTestIssues with MSTest that are not specific to more refined area (e.g. analyzers or assertions)Issues with MSTest that are not specific to more refined area (e.g. analyzers or assertions)
