Unnecessary Test Fixture Class Construction Is Undesirable
Unit testing for .NET
Brought to you by:
charliepoole
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.
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?
View and moderate all "feature-requests Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Feature Requests"
View and moderate all "feature-requests Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Feature Requests"
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.
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?
View and moderate all "feature-requests Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Feature Requests"
I will try to come up with a simple reproduce and create a bug report.