Properties are not applied for parameterized tests
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
NUnit Framework |
Triaged
|
Wishlist
|
Unassigned |
Bug Description
NUnit 2.6.2
I have a custom attribute for my property
[AttributeU
internal class NeedRecreateDat
{
public const string PROPERTY_NAME = "NeedRecreateData";
public NeedRecreateDat
: base(true)
{
}
}
It is applied ok when used with [Test] attribute:
[Test]
public void Test_Assign_
{
...
}
[TearDown]
public void TestTeadDown()
{
if (TestContext.
{
}
}
But when paired with [TestCase] attribute, the property is not applied
(TestContext.
Changed in nunit-3.0: | |
importance: | Undecided → Wishlist |
Changed in nunit-3.0: | |
status: | New → Triaged |
Actually, it is being applied to the method. However, in this situation, ParentTest, you
the method corresponds to a suite containing all your test cases, rather
than to an individual test case. If we gave you the ability (we don't) to
access the containing suite via something like TestContext.
could find the property there. However, that would involve writing methods
for test cases differently from simple tests and I think it should be
avoided.
I'm inclined to mark this bug "Won't Fix" but I'll give you a chance to
make some suggestions first. :-)
Charlie
On Mon, Aug 5, 2013 at 3:36 AM, Dunemaster <email address hidden> wrote:
> Public bug reported: (AttributeTarge ts.Method, AllowMultiple = false)] aAttribute : PropertyAttribute aAttribute( ) String( ) CurrentContext. Test.Properties .Contains( NeedRecreateDat aAttribute. PROPERTY_ NAME)) ata(); CurrentContext. Test.Properties .Contains( NeedRecreateDat aAttribute. PROPERTY_ NAME) /bugs.launchpad .net/bugs/ 1208356 /bugs.launchpad .net/nunitv2/ +bug/1208356/ +subscriptions
>
> NUnit 2.6.2
> I have a custom attribute for my property
>
> [AttributeUsage
> internal class NeedRecreateDat
> {
> public const string PROPERTY_NAME = "NeedRecreateData";
>
> public NeedRecreateDat
> : base(true)
> {
>
> }
> }
>
> It is applied ok when used with [Test] attribute:
>
> [Test]
> [NeedRecreateData]
> public void Test_Assign_
> {
> ...
> }
>
>
> [TearDown]
> public void TestTeadDown()
> {
> if
> (TestContext.
> {
> PrepareFixtureD
> }
> }
>
>
> But when paired with [TestCase] attribute, the property is not applied
> (TestContext.
> == false)
>
> ** Affects: nunitv2
> Importance: Undecided
> Status: New
>
> --
> You received this bug notification because you are subscribed to NUnit
> Extended Testing Platform.
> https:/
>
> Title:
> Properties are not applied for parameterized tests
>
> To manage notifications about this bug go to:
> https:/
>