I am trying to skip a test, for now, using XUnit's Skip property on the Fact attribute, i.e. [Fact(Skip="reason")]. The VS Test runner correctly skips this test, but NCrunch keeps running this test regardless. Is this a bug? or a feature request? Or, am I doing something wrong?
Thanks!
Build/Test Issues
Ncrunch is not observing the XUnit FactAttribute's Skip property
Started by jesse10581 on 2,968 views
Remco NCrunch Developer
#13255
22 Mar 2019 22:13 UTC
Hi, thanks for sharing this issue.
I hope you're ok with me asking a few questions about your environment. This seems to be working correctly at my end, so there must be a variable here somewhere.
- Which version of .NET are you using? (i.e. .NET Framework, .NET Core, etc)
- Which version of Xunit are you using?
- Which version of NCrunch are you using?
- Can you share the exact syntax you're using to declare the test method?
I hope you're ok with me asking a few questions about your environment. This seems to be working correctly at my end, so there must be a variable here somewhere.
- Which version of .NET are you using? (i.e. .NET Framework, .NET Core, etc)
- Which version of Xunit are you using?
- Which version of NCrunch are you using?
- Can you share the exact syntax you're using to declare the test method?
Ncrunch 3.24.0.5
.NET Core SDK 2.2.101 (x64)
xUnit 2.4.1
VS 2017 15.19.5
Now that I think about it, it might have to do with my custom Fact derivative that I created:
[DebugOnlyFact]
public async Task RunCashFlowSimOnOpenEnvDataAndMappedData_ResultsMatch()
And the implementation is here:
public class DebugOnlyFact : FactAttribute
{
public DebugOnlyFact()
{
#if !DEBUG
Skip = "Only run on a developer machine when building in debug mode.";
#endif
}
}
I'm sorry that I didn't even mention this! I guess I had figured that since it was working in the VS Test Runner that it must've meant that you didn't support the Skip attribute property at all.
.NET Core SDK 2.2.101 (x64)
xUnit 2.4.1
VS 2017 15.19.5
Now that I think about it, it might have to do with my custom Fact derivative that I created:
[DebugOnlyFact]
public async Task RunCashFlowSimOnOpenEnvDataAndMappedData_ResultsMatch()
And the implementation is here:
public class DebugOnlyFact : FactAttribute
{
public DebugOnlyFact()
{
#if !DEBUG
Skip = "Only run on a developer machine when building in debug mode.";
#endif
}
}
I'm sorry that I didn't even mention this! I guess I had figured that since it was working in the VS Test Runner that it must've meant that you didn't support the Skip attribute property at all.
Remco NCrunch Developer
#13258
22 Mar 2019 23:02 UTC
NCrunch will usually build in debug mode, so I guess it will never skip this :)
Thank you. I was able to get it working once you mentioned that it was building in debug mode. I found the setting in your documentation to switch that, and it properly ignores the test now. I appreciate your prompt support!
Post a reply
Log in to reply.