testfx
testfx copied to clipboard
Provide a way to specify the test name for a data row test
Description
Currently, MSTest V2 constructs the name of the test using the specified parameters and this can be very long for some scenario and also not intention revealing about the actual sub test being performed.
It would be better to have a way to specify the name for a test.
Steps to reproduce
Expected behavior
DataRow(1,2,3,TestName="Sequential numbers") DataRow(2,4,6,TestName="Even numbers")
should display Test Passed - Sequential numbers Test Passed - Even numbers
Actual behavior
DataRow(1,2,3) DataRow(2,4,6)
Test Passed - TestSomeNumbers (1,2,3) Test Passed - TestSomeNumbers (2,4,6)
Environment
MSTest V2
@stecydube : There is indeed a way to specify testname for a datarow test. You can try something like:
[TestMethod]
[DataRow(1,2,3, DisplayName ="Sequential numbers")]
public void TestSomeNumbers (int x, int y, int z)
{
Assert.IsTrue(true);
}
@pvlakshm : Can we add some examples for datarow attribute in documentation here to prevent such issues in future?
Great, thank you!
I will mark this as fixed because the property is listed in the official API doc: https://learn.microsoft.com/dotnet/api/microsoft.visualstudio.testtools.unittesting.datarowattribute.displayname