6

I'm having tests like so:

[DataTestMethod]
[DataRow("example1")]
[DataRow("example2")]
public void Test_Example(string name)
{
  // test logic
}

Our logging system is currently implemented in a single [TestCleanup] method in a base [TestClass].

I can access the test method's name via the TestContext property, but that does not include any info regarding the datarow parameters.

Is it possible to get these values somehow? In [TestCleanup] or in [TestInitialize] would do fine.

FDM
  • 628
  • 6
  • 18

1 Answers1

0

Have you looked at the DataRow property on the TestContext object? This might be what you're after.

https://learn.microsoft.com/en-us/dotnet/api/microsoft.visualstudio.testtools.unittesting.testcontext.datarow?view=mstest-net-1.2.0

Jelleh
  • 116
  • 7
  • Nope, that only has data when using [DataSource] rather than [DataRow]. That's what we used before. – FDM Sep 04 '18 at 14:35