-
Notifications
You must be signed in to change notification settings - Fork 768
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
Is it possible to get name/context of the running test? #416
Comments
Sorry, there is no equivalent to TestContext in xUnit.net. |
Maybe it is good time to implement it? Who is the idiot thinking that xUnit is replacement for unit testing system in VS2015? |
Duplicated by #1359 |
There actually is a way for getting some of current test information, but for some reason not exposed to general public. public class Tests
{
public Tests(ITestOutputHelper output)
{
var type = output.GetType();
var testMember = type.GetField("test", BindingFlags.Instance | BindingFlags.NonPublic);
var test = (ITest)testMember.GetValue(output);
}
<...>
} @bradwilson there already is a test context being used in xUnit, why can't it be injected just like |
@laurynasr This worked perfectly for my use case. +1 |
I wish we could do this without needing to resort to reflection (or even without requesting an ITestOutputHelper). |
i needed this for a few of my projects. so i bundled it into my xunit logging lib https://github.com/SimonCropp/XunitLogger#current-test |
There seem to be fundamental gaps in the Xunit framework, such as parameters via console not being supported, no Are these things even being considered for implementation? |
We moving from nUnit to xUnit.
In nUnit we were using TestContext to get name of running test to collect some performance stats on running tests.
Is it possible in xUnit?
The text was updated successfully, but these errors were encountered: