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
When you have a test class with a ClassInitialize-Method and that method fails. Only one of the actual test methods is reported as failed. The other methods seem to execute regardless.
Steps to reproduce
Create a .NET Core UnitTest project in Visual Studio 2019
Add the following test class
[TestClass]publicclassUnitTest1{[ClassInitialize]publicstaticvoidClassInit(TestContexttc){thrownewException("DIE IN INITIALIZE");}[TestMethod]publicvoidTestMethod1(){Console.WriteLine(nameof(TestMethod1));}[TestMethod]publicvoidTestMethod2(){Console.WriteLine(nameof(TestMethod2));}[TestMethod]publicvoidTestMethod3(){Console.WriteLine(nameof(TestMethod3));}}
All test methods are "failed" (i.e. not run, because the initializer method failed). That was also the behaviour with MSTest 1.3.0 / full Framework.
Actual behavior
Only the first test (here TestMethod1) is failed with the correct error message (that the initializer failed). Other test methods run anyway (output Console.WriteLine messages). Messages will possibly only be visible from VS Test Explorer because of microsoft/vstest#799.
Environment
Windows 10
Visual Studio 2019 16.3
MSTest.TestAdapter 2.0.0
MSTest.TestFramework 2.0.0
The text was updated successfully, but these errors were encountered:
We are seeing this behavior as well for .Net Core. This is making debugging very hard as a lot of tests fail later on because the setup was incomplete. We have to go and try finding which test kicked off the class initialize and see its logs. @parrainc and @AbhitejJohn is there a workaround or a fix planned for this?
Hey folks! I am reviewing this issue and managed to reproduce with the version indicated but it seems that the issue was fixed with 2.2.0 and later versions.
I will move forward and close this issue as fixed.
Description
This is based on this StackOverflow question: https://stackoverflow.com/q/59624616/21567
When you have a test class with a ClassInitialize-Method and that method fails. Only one of the actual test methods is reported as failed. The other methods seem to execute regardless.
Steps to reproduce
Project File:
dotnet test
Expected behavior
All test methods are "failed" (i.e. not run, because the initializer method failed). That was also the behaviour with MSTest 1.3.0 / full Framework.
Actual behavior
Only the first test (here TestMethod1) is failed with the correct error message (that the initializer failed). Other test methods run anyway (output
Console.WriteLine
messages). Messages will possibly only be visible from VS Test Explorer because of microsoft/vstest#799.Environment
The text was updated successfully, but these errors were encountered: