0

I created custom property attribute to link every system test to its driving requirements which is similar to something described in the link below:

NUnit - Multiple properties of the same name? Linking to requirements

I used the code given in the above link

[Requirements(new string[] { "FR50082", "FR50084" })]

[Test]

public void TestSomething(string a, string b) { // blah, blah, blah

Assert.AreNotEqual(a, b); }

which gets displayed in Test explorer (filter by traits) as :-

Requirements[System.String[]] (1)

TestSomething.....

But this is not what I was expecting. I require every requirement to get displayed individually though they are associated to the same test case in test explorer window.

I want to get it displayed as (in test explorer):-

Requirements[FR50082] (1)

   TestSomething.....

Requirements[FR50084] (1)

   TestSomething.....

and so on....

So, if I am associating n number of Requirements to a test case, the test explorer should display the same test case n times under different requirements. Please let me know how could this be achieved ??

Community
  • 1
  • 1
Charu
  • 13
  • 5

1 Answers1

-1

It sounds like you are heading down the BDD (Behavior Driven Design) route. SpecFlow is a good choice in .Net if you don't mind a VS extension.

The big win for you I think would be that you can reuse step definitions, what you're calling TestSomething. You can set up different contexts, your Requirements, as I'm reading them, and in the Then step call your TestSomething to verify all is well.

Trey Mack
  • 4,215
  • 2
  • 25
  • 31