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

Notification

Icon
Error

Unable to cast object of type 'STATestCase' to type 'Xunit.Sdk.XunitTestCase'.
sjkirk
#1 Posted : Thursday, October 13, 2016 6:55:39 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 12/23/2015(UTC)
Posts: 9
Location: United Kingdom

Thanks: 1 times
Was thanked: 2 time(s) in 2 post(s)
As I mentioned before I'm trying to get the GitHub for Visual Studio extension working with NCrunch, but I've hit another problem.

In ours tests we use STATestCase (from here): https://github.com/githu...ts/XUnit/STATestCase.cs

I'm getting the following error from NCrunch:

Quote:
An error occurred while analysing this project after it was built: System.Exception: Exception during discovery:
System.InvalidCastException: Unable to cast object of type 'STATestCase' to type 'Xunit.Sdk.XunitTestCase'.
at nCrunch.Module.XUnit2.Integration.XUnitDiscoveryMessageSink.OnMessage(IMessageSinkMessage message)
at nCrunch.Module.XUnit2.Integration.XUnitMessageSinkAdapter.OnMessage(IMessageSinkMessage message)
at Xunit.Sdk.SynchronousMessageBus.QueueMessage(IMessageSinkMessage message)
at Xunit.Sdk.XunitTestFrameworkDiscoverer.FindTestsForMethod(ITestMethod testMethod, Boolean includeSourceInformation, IMessageBus messageBus, ITestFrameworkDiscoveryOptions discoveryOptions)
at


As you can see from the code, STATestCase implements IXunitTestCase but does not derive from XunitTestCase. Could NCrunch use the IXunitTestCase interface instead?
Remco
#2 Posted : Thursday, October 13, 2016 10:13:42 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
Hi, thanks for sharing this problem.

This change has recently been requested and it seems to be getting quite popular (see https://ncrunch.uservoice.com/forums/245203-feature-requests/suggestions/16474246-to-support-custom-xunit-test-cases).

It may actually be as simple as just switching to the interface. I'll need to investigate further. Toolsets that implement their own tests under the hood can sometimes implement unexpected logic that NCrunch can't handle (NUnit saw lots of this), so it's hard for me to promise that this will work perfectly under NCrunch. I'll see what I can do about including something for this in the V3 release due out in the next few weeks.
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.024 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download