We use VSTS to run NUnit based tests on remote machine using NUnit3TestAdapter version 3.9.0. Tests are run from several classes.
My question is, how to print name of the class (or any other indicator that particular tests are from given class) between names of tests in the output.
In each class we have tests with the same name so such printing is confusing.
Example of current log (ShouldUseXXX tests are from different classes):
2017-11-27T15:27:13.6613340Z Information: NUnit3TestExecutor converted 4 of 4 NUnit test cases
2017-11-27T15:27:14.2773340Z Passed ShouldCreateXXX
2017-11-27T15:27:14.2783340Z Passed ShouldReturnXXX
2017-11-27T15:27:14.2783340Z Passed ShouldUseXXX
2017-11-27T15:27:14.2783340Z Passed ShouldUseXXX
You can add a TestCase
attribute to your test method with the TestName
property completed.
There are various placeholders you can add to provide a template for your test names but simply using "{c}.{m}"
would give you the class name followed by the method name. More details of the various options here
As a full example:
[TestFixture]
public class When_Working_Up_A_Storm
{
[Test]
[TestCase(TestName = "{c}.{m}")]
public void MagicHappens()
{
}
}
The above code will produce the name "When_Working_Up_A_Storm.MagicHappens" rather than just "MagicHappens"