This project is read-only.


NUnit Test, SetUp and TestFixtureSetUp attributes are misidentified


StatLight v1.1.3802, treats [TestFixtureSetUp] as a Test and a SetUp in NUnit Test Provider case. Hence calling TestFixtureSetUp as a test and setup method.
As far as I can trace from code:
StatLight.Client.Harness.Hosts.MSTest.UnitTestProviders.DynamicAtttibuteHelper class has an extension method on MemberInfo which identifies if an attribute with a given name exists on a method. Since String.Contains is used in the attribute name matching logic, any attribute in any method which contains "Test" string is assumed as a TestMethod or any attribute in any method which contains "SetUp" is assumed as a SetUp method ... Hence Test methods, SetUp Methods and FixtureSetUp are mixed-up in the test runner. You can see [TestFixtureSetUp] method is called as a SetUp method before every time a Test method is called, and the genuine [SetUp] method is never getting called at all. Same is true for [TestFixtureTearDown] and [TearDown] attributes as well
You can reproduce this by running the following test:
public class UniTestTemplate
    public void FixtureSetUp()
        Console.WriteLine("Test Fixture SetUp...");            
    public void FixtureTearDown()
        Console.WriteLine("Test Fixture TearDown...");
    public void SetUp()
    public void TearDown()
    public void Test1()
        Assert.AreEqual(1, 1);
Closed Sep 25, 2010 at 8:39 AM by staxmanade
Thanks for the great investigative work. Please take a look at the v1.2 build on the downloads page and let me know if this issue is not resolved for you.You can also see the code changes in the following commit


bgorkem wrote Sep 27, 2010 at 4:40 PM

Yes it worked thanks for the quick turnaround.

wrote Feb 14, 2013 at 9:18 PM

wrote May 16, 2013 at 10:50 AM