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

Notification

Icon
Error

NUnit ITestAction not executed in 2.4 (works in 1.48.5)
topdownjohnny
#1 Posted : Monday, February 3, 2014 11:06:08 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 11/6/2012(UTC)
Posts: 7

Hi,

I have an attribute I use on tests:

Code:
public class FunctionVerifierAttribute : Attribute, ITestAction
   {
      private readonly SimpleFunctionVerifier _verifier;
      public FunctionVerifierAttribute(params FunctionType[] roles)
      {
         _verifier = new SimpleFunctionVerifier();
         roles.ToList().ForEach(i => _verifier.FunctionTypes.Add(i));

      }

      public void BeforeTest(TestDetails testDetails)
      {
         var fixture = testDetails.Fixture as IHasUserState;
         if (fixture == null)
            throw new Exception("Fixture does not implement IHasIUserState");

         fixture.UserState.FunctionVerifier = _verifier;
      }

      public void AfterTest(TestDetails testDetails)
      {
      }

      public ActionTargets Targets
      {
         get { return ActionTargets.Test; }
      }
   }


In 1.48.5 the BeforeTest is hit when I debug, in 2.4 it's not. Bit of a bummer that I now have failing tests :-(.
Remco
#2 Posted : Monday, February 3, 2014 11:21: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)
Hi,

Thanks for sharing this issue.

I've just run some tests on this myself but haven't had any luck in reproducing the issue. Is there any chance you could create a small cut-down solution reproducing the problem that you could share with me? You can submit any code via the contact form on this website - http://www.ncrunch.net/Support/Contact.


Cheers,

Remco
Remco
#3 Posted : Monday, February 10, 2014 10:02:51 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)
Hi John -

Sorry I've had no luck receiving your emailed attachment with this issue in it ... and your mail server seems to be blocking all replies I've sent to the email you contacted me with. It seems communication is being quite a challenge for us at the moment! Do you have a different email you can contact me with?


Cheers,

Remco
topdownjohnny
#4 Posted : Wednesday, February 12, 2014 10:35:52 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 11/6/2012(UTC)
Posts: 7

Hi Remco,

I updated my emailaddress in my account, you can use that.

John
Remco
#5 Posted : Thursday, February 13, 2014 12:58: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 John! From the code sample you've sent, I've managed to reproduce and analyse the issue.

The problem is caused by the NUnit.Framework.dll assembly being resolved twice inside the NCrunch test environment. NCrunch V2.X is packaged with NUnit 2.6.3, and the solution you're working with uses NUnit 2.6.2. Because of the version inconsistency, the framework DLL gets loaded twice each time under a different version. This skews the CLR's internal logic and causes some very strange things to happen inside NUnit.

Most NUnit features seem to be able to operate normally, but ITestAction appears to be different. The difference between assemblies causes NUnit's references to this interface to fail without a consistent pattern. This means that on some systems the problem appears, while other systems are perfectly OK.

The easiest solution is to just delete the file: C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\Remco Software\NCrunch for Visual Studio 2013\NUnit.Framework.dll

This file was never supposed to be included in the NCrunch installer, as there is no need for it when solutions already have it included. It only seems to be causing problems anyway. I'll ensure its removed for all future versions of NCrunch.

Thanks for all your help in getting to the bottom of this one.


Cheers,

Remco
1 user thanked Remco for this useful post.
alexquick on 2/14/2014(UTC)
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.043 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download