Hi,
in case of default Trait, i.e
[Fact, Trait("Category","Test")]
I could see NCrunch filters out with given Trait name as category well. From that, I tried to this
public class CustomTraitAttribute : TraitAttribute
{
const string DefaultName = "DefaultCategory")
CustomTraitAttribute(string value) : base (DefaultName,value) {}
}
then mark it
[Fact, CustomTrait("Test")]
and now NCrunch does not filters out via trait name, also it automatically skips test and can't lookup in test cases list.
Is there any specific configuration required to make those custom trait as same as default trait attribute?
Thanks in advance.
Remco NCrunch Developer
#5200
03 Feb 2014 23:05 UTC
Hi, thanks for sharing this issue.
NCrunch does support custom trait attributes, but only if the Framework Utilisation Type for XUnit/Gallio is set to 'DynamicAnalysis'.
The reason for this is that NCrunch needs to execute your run-time code in order to resolve the custom trait. This is something that Static Analysis cannot do, as Static Analysis can only skim over the assembly metadata.
There is an unfortunate drawback involved in making this switch. The Gallio adapter being used by NCrunch to integrate with XUnit does not perform very well with Dynamic Analysis. It's for this reason that the default is set to Static Analysis. You may want to experiment with this setting to see if the performance cost is worth having strongly typed categories.
There are plans to introduce direct integration between NCrunch and XUnit with the new XUnit version soon being released (XUnit V2). In doing so, performance for Dynamic Analysis will likely be improved.
Cheers,
Remco
NCrunch does support custom trait attributes, but only if the Framework Utilisation Type for XUnit/Gallio is set to 'DynamicAnalysis'.
The reason for this is that NCrunch needs to execute your run-time code in order to resolve the custom trait. This is something that Static Analysis cannot do, as Static Analysis can only skim over the assembly metadata.
There is an unfortunate drawback involved in making this switch. The Gallio adapter being used by NCrunch to integrate with XUnit does not perform very well with Dynamic Analysis. It's for this reason that the default is set to Static Analysis. You may want to experiment with this setting to see if the performance cost is worth having strongly typed categories.
There are plans to introduce direct integration between NCrunch and XUnit with the new XUnit version soon being released (XUnit V2). In doing so, performance for Dynamic Analysis will likely be improved.
Cheers,
Remco
Thanks for clarification, I'll work with default trait for a while and once Xunit v2 and its support available, will revisit it.
Post a reply
Log in to reply.