nunit-core team mailing list archive
-
nunit-core team
-
Mailing list archive
-
Message #03537
[Bug 1208356] Re: Properties are not applied for parameterized tests
Well, I think applying the property to all test cases is reasonable behavior.
Otherwise, mentioning in [TestCase] and [Property] documentation that they do not work together will be a good thing, may it will save an hour for several people
--
You received this bug notification because you are a member of NUnit
Developers, which is subscribed to NUnit V2.
https://bugs.launchpad.net/bugs/1208356
Title:
Properties are not applied for parameterized tests
Status in NUnit V2 Test Framework:
New
Bug description:
NUnit 2.6.2
I have a custom attribute for my property
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
internal class NeedRecreateDataAttribute : PropertyAttribute
{
public const string PROPERTY_NAME = "NeedRecreateData";
public NeedRecreateDataAttribute()
: base(true)
{
}
}
It is applied ok when used with [Test] attribute:
[Test]
[NeedRecreateData]
public void Test_Assign_String()
{
...
}
[TearDown]
public void TestTeadDown()
{
if (TestContext.CurrentContext.Test.Properties.Contains(NeedRecreateDataAttribute.PROPERTY_NAME))
{
PrepareFixtureData();
}
}
But when paired with [TestCase] attribute, the property is not applied
(TestContext.CurrentContext.Test.Properties.Contains(NeedRecreateDataAttribute.PROPERTY_NAME) == false)
To manage notifications about this bug go to:
https://bugs.launchpad.net/nunitv2/+bug/1208356/+subscriptions
Follow ups
References