Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

XUnit 1.9.2 tests not found when a custom TraitAttribute used
piotrczarnas
#1 Posted : Tuesday, May 12, 2015 6:27:16 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 5/12/2015(UTC)
Posts: 1
Location: Poland

Hi,

I have XUnit 1.9.2 tests with a custom TraitAttribute. Tests are found when the test class is not attributed with a custom trait attribute.
The trait attribute is:

[AttributeUsage(AttributeTargets.Class | AttributeTargets.Assembly | AttributeTargets.Method, AllowMultiple = true, Inherited = true)]
public class CustomTestCategoryAttribute : Xunit.TraitAttribute
{
internal CustomTestCategoryAttribute(string category)
: base("Category", category)
{
}
}

And a usage:
[CustomTestCategory("cat")]
public class MyTest
{

Best Regards,
Piotr
Remco
#2 Posted : Tuesday, May 12, 2015 9:33:45 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,144

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
Hi Piotr,

Unfortunately, the mechanics involved make custom trait attributes impossible to implement when using static analysis.

For this to work, you'll need to set the 'Framework utilisation type for Gallio' solution-level NCrunch configuration setting to 'DynamicAnalysis'. Note that DynamicAnalysis is significantly slower than StaticAnalysis when using Xunit v1. I recommend finding an alternative design if possible.
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.029 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download