-
Notifications
You must be signed in to change notification settings - Fork 81
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
Can output be captured from within IClassFixture<T>? #214
Comments
It might not be clear enough, but the message sink that's sent into fixture constructors can only accept diagnostic messages (that is, messages which implement The "output" concept is only available while a test is running. The validity starts when the test class is created (and the test-specific |
So Xunit.Sdk.TestFrameworkProxy.MessageSinkWrapper injected into fixture instances is supposed to publish nothing? (In other words, the fact that it is injected in the first place is some kind of bug).
Maybe I should re-phrase the question in two parts:
|
As for 2. Debug.WriteLine seems to work, but of course the output is not in Tests tab, but Debug tab of VS' Output window. |
as simplified example as possible:
|
Diagnostic messages don't show up as "output", they show up in the test runner console messages. And they are disabled by default, so you must enable them: https://xunit.net/docs/configuration-files#diagnosticMessages
That's because we do not intercept |
I know (I've read the documentation which I've linked in original post) and I've enabled them in app.config.
Yet they do not show up in any VS output windows. According the documentation they should be visible in VS Output pane, tab Tests, like so:
|
Since this appears to be an issue with either VSTest or the xUnit.net VSTest adapter, I'm moving the issue to the latter's repository for further investigation. |
Hi, thanks for this clarification; using the sink works for me (xunit 2.4.1, VSTest Adapter 2.4.3, VS19 16.8.2), diag messages show up in the console after turning on the setting in the xunit conf. Tx, |
As outlined here https://xunit.net/docs/capturing-output.html the message sink is indeed injected into fixture constructor (the type is
Xunit.Sdk.TestFrameworkProxy.MessageSinkWrapper
), but none of the messages sent to it are visible anywhere.The documentation does not state that IClassFixture extensibility is supported or should work, on the other hand some conforming type is injected into the constructor.
Is there any way how to capture output from class fixtures?
xunit: 2.4.1
netcoreapp2.2
VS: Microsoft Visual Studio Enterprise 2019 Version 16.5.1
The text was updated successfully, but these errors were encountered: