#383 Unnecessary Test Fixture Class Construction Is Undesirable

V2.5
open
nobody
None
5
2009-12-31
2009-12-31
Anonymous
No

It would be nice if the only TestFixture classes that were constructed were the ones being run. I when running a single test case from a single test fixture, It is constructing other unrelated TestFixtures. This is undesirable because it makes a code coverage tool report additional hits if you have code in the constructors that is being run. Even if you recommend not putting anything in the constructor, and even if I do manage to reorganize my code to not have anything in the constructor, I still may run into another situation where it is much easier or necessary to put code in the constructor of a TestFixture class.

Discussion

  • Charlie Poole

    Charlie Poole - 2009-12-31

    I don't fully understand what you are asking for. What do you mean by "other unrelated Test Fixtures"

    Also, are you referring to the gui or console runner?

     
  • Charlie Poole

    Charlie Poole - 2009-12-31
    • status: open --> pending
     
  • Comment has been marked as spam. 
    Undo

    You can see all pending comments posted by this user  here

    Anonymous - 2009-12-31
    • status: pending --> open
     
  • Comment has been marked as spam. 
    Undo

    You can see all pending comments posted by this user  here

    Anonymous - 2009-12-31

    I know for sure that this happens with the GUI runner. I think it also happens with the console runner because the same thing happens when I run it using TestDriven.NET

    What I mean by unrelated TestFixture objects being constructed is that other classes marked as TestFixture from the same project are being constructed. I confirmed this by putting a break point in the constructor of a TestFixture class that I was not running and it was hit.

     
  • Charlie Poole

    Charlie Poole - 2009-12-31

    If this were happening, it would be a serious bug, since that's not how NUnit is designed to work. However, I can't reproduce the problem.

    Constructors for classes that contain instance members used as test data sources is performed whenever tests are loaded and this may be what you are seeing. Do you have 'Reload on Run' turned on?

     
  • Comment has been marked as spam. 
    Undo

    You can see all pending comments posted by this user  here

    Anonymous - 2010-01-02

    I will try to come up with a simple reproduce and create a bug report.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks