-
Notifications
You must be signed in to change notification settings - Fork 84
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
Console output is completely garbled with dotnet test and xUnit #246
Comments
Check out #228. See if the gist I posted and try it out to see if it works :) |
@robdmoore Thanks. I'm busy doing that right now. But I've run into a snag. The way that xUnit works means that each of my test classes needs to declare a constructor that accepts an instance of public DerivedTestClass(ITestOutputHelper output) : base(output) { } |
Yeah, I have a base class that I pass the output helper directly to in each test's ctor. Then I put the test ctor at the bottom of the file so it's less noisy.
…--
On 11 Mar 2017, at 7:55 am, Shayne van Asperen ***@***.***> wrote:
@robdmoore Thanks. I'm busy doing that right now. But I've run into a snag. The way that xUnit works means that each of my test classes needs to declare a constructor that accepts an instance of ITestOutputHelper, and I really don't want to have to add all that noise to my tests. I'm trying to find a way of using the service locator pattern in a base class of mine, or some way of configuring it once at the assembly level so that I don't have to do this in all of my derived test classes:
public DerivedTestClass(ITestOutputHelper output) : base(output) { }
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Thanks @robdmoore I've solved this with a library I wrote: https://github.com/shaynevanasperen/TestStack.BDDfy.Xunit I've been a bit cheeky by naming the NuGet package with the TestStack.BDDfy prefix. If the maintainers of TestStack.BDDfy object to this, I'm happy to pass ownership to them. Hopefully this library will only be a temporary requirement, until TestStack.BDDfy natively supports Xunit parallel test execution (which might also require changes to Xunit). At least it can possibly serve as a starting point in that direction. |
When running
dotnet test
on a .NET Core Unit test project using xUnit v2.2.0, the console output of each test is interleaved with each other, resulting in a completely useless unintelligible mess, as you can see in the attached screenshot.This probably has something to do with xUnit running tests in parallel, and the need for using
ITestOutputHelper
as described here, but I've looked at the code and I can't really tell where to make the fix. I think it might be the ConsoleReporter, which is configured in Processors, but there isn't a way to override this to specify that it should use xUnit'sITestOutputHelper
. I'd be happy to contribute a fix for this, but I'm not sure where to start.This only occurs when using the latest RTM tooling for .NET Core (VS2017). On my other computer which is still running VS2017 RC, I get no console output at all, except for the fully qualified method names of the methods that have the
[Fact]
attribute.The text was updated successfully, but these errors were encountered: