Question

How can I get the data from a row in the current running test? this answers how to get the iteration number ie 0,1,2.. of the running test:

int currentIteration = TestContext.DataRow.Table.Rows.IndexOf(TestContext.DataRow);

However, I would like to get the actual data in this row.

Was it helpful?

Solution

Simpler than I expected. this is for a single column table, so the ItemArray will always be 0:

string currentIterationData = TestContext.DataRow.ItemArray[0].ToString();
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top