I have written some Parameterized Tests, that use the ValueSourceAttribute for some of the test method arguments.
Here from the NUnit doc:
| Complete Test Cases | Data for One Argument ---------|-------------------------|------------------------ Inline | TestCaseAttribute | RandomAttribute | | RangeAttribute | | ValuesAttribute Separate | TestCaseSourceAttribute | ValueSourceAttribute
Is there anyway I can set the test description (specifically in the XML output) for the test cases generated by NUnit's combination of the parameters?
I'm using NUnit 2.5.9.
It's not possible with ValueSourceAttribute
, because it would need to merge all descriptions from all ValueSource
items of all parameters of the parameterized test.
When using the TestCaseAttribute
you can give a description and a test name that should be passed into the result XML.
An example:
[Test]
[TestCase("abc", TestName = "Simple value", Description = "This test uses a simple input value")]
public void TestIt(string value)
{
...
}
There are also some other "special" parameters you can set, see here.
When you are absolutely keen about this feature, you can write your own TestCaseProvider
addin. See the NUnit documentation for more information. This will likely solve your issue. But be warned, this is not a 5-minute thing.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With