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

Notification

Icon
Error

xUnit with custom Fact/Theory attribute
isb-ik
#1 Posted : Wednesday, December 4, 2019 12:23:32 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 7/26/2016(UTC)
Posts: 4
Location: Germany

xUnit can be extended by using custom (inherited) attributes for Fact or Theory. There are some examples an the xUnit site for this.
I'm using a WpfTheory attribute (inherited from Theory) to start my tests in a STA thread to be able to create WPF controls in the tests.
It seems that ncrunch does not find this test methods and not identify them as test methods.
Is there an alternative way to mark the methods as tests?
Remco
#2 Posted : Wednesday, December 4, 2019 8:09:29 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, thanks for posting.

Could you confirm which version of xUnit you're using?

We do support a range of situations with xUnit, though some of the more advanced extensibility features we simply aren't able to handle as they override many of the features of the runner. If you're able to share the code you're using, I can confirm whether this is caused by a defect or whether it is an expected limitation.
isb-ik
#3 Posted : Thursday, December 5, 2019 6:55:21 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 7/26/2016(UTC)
Posts: 4
Location: Germany

Hi, I'm using xUnit 2.4.1.
You can find sample code on the official xunit GitHub repository on https://github.com/xunit.../tree/master/STAExamples.
Remco
#4 Posted : Thursday, December 5, 2019 7:08:17 AM(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)
Thanks for the source link!

Looking at this code, I can confirm that we cannot support this use case.

In this particular instance, the test case itself derives from IXunitTestCase and implements its own custom logic. For NCrunch to be able to work with Xunit, we need to make several assumptions about the structure of the test cases and the manner of their execution. The extensibility shown in this example invalidates our assumptions. I'm sorry, but we can't support this kind of extensibility.
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.031 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download