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
This may be related to #173 but I am not qualified to understand that issue.
When a test writes to stdout, VS own test runner captures output into the test report, and makes it available in Test Explorer under the Output link. xUnit runner does not do that.
This is essential in test development, since some values need to be printed to be compared against. In my particular case, I am testing a compiler and much match its expected error messages. Of course I can see them by breaking into a debugger while running tests, but that has become a major hassle since I switched to xUnit.
Sample code:
using System;using MS=Microsoft.VisualStudio.TestTools.UnitTesting;using Xunit;publicclassBlueprintSyntax{[Fact]publicvoidXUnitFact(){
Console.WriteLine("xUnit output");}};[MS.TestClass]publicclassSample{[MS.TestMethod]publicvoidMSTestCase(){
Console.WriteLine("MS output");}};
The text was updated successfully, but these errors were encountered:
The design of xUnit.net v2 makes such designs impossible. The Console is a shared resource, and writing to that Console contains no context information in which to relate the written text back to the writer. Since many unit tests are running in parallel, it is therefore impossible to relate the written text back to the unit test in question.
We did support this in v1, because we didn't support parallelization. MSTest similarly supports this because they do not support parallelization.
Our alternative is ITestOutputHelper, which you can accept as a constructor argument for your unit test. An example of the usage can be found here:
This may be related to #173 but I am not qualified to understand that issue.
When a test writes to stdout, VS own test runner captures output into the test report, and makes it available in Test Explorer under the Output link. xUnit runner does not do that.
This is essential in test development, since some values need to be printed to be compared against. In my particular case, I am testing a compiler and much match its expected error messages. Of course I can see them by breaking into a debugger while running tests, but that has become a major hassle since I switched to xUnit.
Sample code:
The text was updated successfully, but these errors were encountered: