Menu

All NUnit tests fail

Anonymous
2005-02-28
2013-03-07
  • Anonymous

    Anonymous - 2005-02-28

    Hi Richard,

    I've updated to the latest version and I ran the NUnit tests and they all fail.

    It states: "Object reference not set to an instance of an object" in the <TestFixtureTearDown()> Dispose method in all tests.

    I'm using NUnit 2.2 and also TestDriven.NET.

    Any idea why it fails?

    Dan Mayer

     
    • Richard Banks

      Richard Banks - 2005-02-28

      Hi Dan,

      I've not used TestDriven.net so I'm not sure if that is causing the problem.

      In any case, I've been testing with Nunit 2.2.2 so it might be worth updating to see if that fixes the problem.  I doubt it, but it's worth a shot.

      NUnit will normally give a stack trace of where an error occured - I don't know if that happens if the tear down fails.  But if it does can you let me know what it says?

      Alternatively, set a breakpoint in the tear down (before dispose fires).  When you hit the breakpoint go to the Debug->Exceptions menu item in VStudio, and set the debugger to break on all CLR exceptions.  You should find that when the exception is raised the debugger will highlight the line of code for you (or at least give you a call stack to look at).

      Let me know how you go.
      - Richard.

       
    • Anonymous

      Anonymous - 2005-03-01

      Hi Richard,

      I've uninstalled TestDriven.NET to verify if it causes the problem, but unfortunately it didn't help.

      So, I've copied the NUnit directory into a different name and did an update.
      I got a different directory.
      It didn't have the solution file it had before and it had a reference to Atoms.Framework.
      Also, It does not pass compilation.

      Could you please check your code.

      Also, I looked in NUnit web site and I couldn't find version 2.2.2. Is this a new version or a beta version?

      Dan Mayer

       
      • Richard Banks

        Richard Banks - 2005-03-01

        Hi Dan,

        The reference/namespace problem was my fault.  I was playing around with different namespace structures and let it slip through - sorry about that.  Update from CVS again and you should be fine.

        Nunit 2.2.2 is the latest version - it's listed on their sourceforge downloads page (even though it's not listed on the official web site).

        In any case I've got another machine with 2.2 on it and all the unit tests worked correctly.

        One thing to be aware of is that now with the separate .dll files for the database providers you must copy the AF_OLEDB.dll into the nunit bin directory in order to have the tests work.

         
    • Anonymous

      Anonymous - 2005-03-02

      Hi Richaed,

      I've downloaded the latest code from CVS and also I found NUnit's version 2.2.2 and installed it. But, it didnt't help. It still fails.

      I did some investigation and found that the BaseDirectory in the Init() method is pointing to NUnit's bin directory. And, when it tries to delete db1.mdb it can't find it. Nor it cannot find "original db1.mdb" to copy to db1.mdb nor AtomsFramework.xml.
      To solve the problem I've set the CurrentDriectory to the NUnit bin parent directory in every test i.e. NUnit directory (I've used System.IO.DirectoryGetParent()).

      Can you check this again please?

      Dan Mayer

       
      • Richard Banks

        Richard Banks - 2005-03-02

        Hi Dan,

        The "Original db1.mdb" file is definitely in CVS.  See http://cvs.sourceforge.net/viewcvs.py/jcframework/Nunit/original%20db1.mdb?rev=1.13&view=log

        The "Environment.CurrentDirectory = System.AppDomain.CurrentDomain.BaseDirectory" line in the init() sub should set the current directory back to the source code directory, as this should be the application is run from when using Nunit.

        Make sure that the nunit_atomsframework.nunit file is in the source code directory, not the bin directory.  I haven't
        tried but setting this elsewhere will probably effect where Nunit thinks the base directory is.

        Also, if I set a break point at the start of init and look at System.AppDomain.CurrentDomain in the quick watch window I see the following:
        BaseDirectory = C:\Path\Nunit
        RelativeSearchPath = bin
        SetupInformation.ApplicationBase = C:\Path\Nunit
        SetupInformation.ApplicationName = Tests
        SetupInformation.ConfigurationFile = C:\Path\Nunit\App.Config

        Can you check these settings against what you are seeing.  Maybe I need to use the SetupInformation.ApplicationBase instead of the AppDomain base directory.

        - Richard.

         
    • Anonymous

      Anonymous - 2005-03-03

      Hi Richard,

      Found the problem.
      Its with an VS addin called TestDriven.NET that I'm using.

      I've checked the values of the variables you wrote and they weren't what you wrote.
      So, I suspected that the problem is with the addin.
      I uninstalled both the addin and NUnit and reinstalled NUnit.
      Then, I compiled and ran the tests and it all passed.

      I'll write to the guys that develop the addin.

      Thanks,

      Dan

       
      • Richard Banks

        Richard Banks - 2005-03-03

        Hi Dan,

        I'm glad you found the problem.  I was starting to run out of ideas to try :-)

        - Richard.

         

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.