I'm linking all our our System Tests to test cases and to our Requirements. Every requirement has an ID. Every Test Case / System Tests tests a variety of requirements. Every module of code links to multiple requirements.
I'm trying to find the best way to link every system test to its driving requirements.
I was hoping to do something like:
[NUnit.Framework.Property("Release", "6.0.0")]
[NUnit.Framework.Property("Requirement", "FR50082")]
[NUnit.Framework.Property("Requirement", "FR50084")]
[NUnit.Framework.Property("Requirement", "FR50085")]
[TestCase(....)]
public void TestSomething(string a, string b...)
However, that will break because Property is a Key-Value pair. The system will not allow me to have multiple Properties with the same key.
The reason I'm wanting this is to be able to test specific requirements in our system if a module changes that touches these requirements.
Rather than run over 1,000 system tests on every build, this would allow us to target what to test based on changes done to our code.
Some system tests run upwards of 5 minutes (Enterprise healthcare system), so "Just run all of them" isn't a viable solution. We do that, but only before promoting through our environments.
Thoughts?
For some reason I could not add the link to the google discussion post to the comment above, so I have added the post here too. (The link is https://groups.google.com/forum/#!topic/nunit-discuss/ndV3VTPndck)
A Category is always displayed in TE as "Category [xxxxxxx]", where xxxxx is whatever string you send in, if you don't specify any, it will be the name of the class derived from CategoryAttribute.
If you want to use Category, you should, as Charlie said on the google post, use one entry per requirement. If you add the string Requirement to the value, it can look pretty good, but most follow the rules in (1) above, it could be like:
Category[Requirement:FR12345]
Code:
Code:
4: If you want to have multiple requirements per test and still have something like the display in (3), you must make the keys unique. It doesn't need to look too bad. In the code below I have just added a counter to it. It will display as :
Requirement-1[FR12345]
Requirement-2[FR23456]
Code:
and you use it like:
(And if you want a syntax without the "new", the previous answer show that syntax with the param instead.)
Option 4 will not group by requirement number, but by the counter. If you want to group by requirement number you can use option 5:
5. Add the requirement number to the key, but leave the value blank. It will look like:
Requirement-FR12345
In this way, you also skip the prefix and have each requirement as its own kind of category in the TE.
Code:
And, you could of course also skip the prefix altogether.
Have you considered a custom property attribute derived from
NUnit.Framework.Property
?Something like the following seems like it might work for you judging by a LINQPad 4 "query" with Language set to C# Program and a reference to
nunit.framework.dll
(version 2.4.8) added: