I've implemented a data driven test using MsTest framework.
I was wondering if there was a way to get the iteration / line number of the current test code from the TestContext object?
As far as I can see, the only property relevant to DDT is DataRow that enables getting info for the current iteration from the data source, but I don't see any property that gives me what I need.
When a test is marked as data theory, the data fed into it from the data source is directly mapped to the parameters of the test method.
Used to store information that is provided to unit tests.
Try this:
int currentIteration = TestContext.DataRow.Table.Rows.IndexOf(TestContext.DataRow);
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