-
Notifications
You must be signed in to change notification settings - Fork 80
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
Tests are not discovered when using attribute inherited from TheoryData
#418
Comments
Is this v2 or v3? What package version(s) are you using? |
xunit 2.9.0, xunit.runner.visualstudio 2.8.2, Microsoft.NET.Test.Sdk 17.11.1 |
I not 100% sure I can reproduce this, in part because I don't know what Making a guess as to it throwing some kind of exception, here is my repro: using System;
using Xunit;
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
public class DebugOnlyTheoryAttribute : TheoryAttribute
{
public DebugOnlyTheoryAttribute(string comment = "meh")
{
#if !DEBUG
throw new ArgumentException(comment);
#endif
}
}
public class TestClass
{
[DebugOnlyTheory]
[InlineData("string1")]
[InlineData("string2")]
public void Method1(string _) { }
} This is what I see when running in Debug:
This is what I see when running in Release:
(This failure is exactly what I'd expected, given that throwing an exception in the test class constructor should surface like this.) Can you provide a repro project & steps? |
The tests are not discovered when I use the inherited attribute -
DebugOnlyTheoryAttribute : TheoryAttribute
.When I change
DebugOnlyTheory
to justTheory
it works again.The text was updated successfully, but these errors were encountered: