I am trying to extract some information about the parameter variants used in an MSTEST data driven test case from trx file. Currently, For data driven tests, I get the output of same testcase with different inputs as a sequence of tags , but there is no info about the value of the variants.
Exampl开发者_开发百科e:
Suppose we have a [data driven]TestMethod1() and the data rows contain variations a and b. There are two variations a=1,b=2 for which the test passes and a=3,b=4 for which the test fails.
If we can output the info that it was a=1,b=2 which passed and a=3 b=4 which failed in the trx file; the output will be meaningful.
- Better information about test case runs from the output file alone(without any dependencies).
- Investigating the test failure without rerunning the whole set
- If the data rows change in data source(now a=1,b=2 pass and a=5,b=6 fail) , easy to decipher that the errors are different; although the fail sequence is still the same(row 0 pass row 1 fail but now row1 is different)
Has any of you gone through a similar problem? What did you follow? I tried to put the parameter value information in the Description attribute of TestMethod, it didnt work. Any other methods you think can work too?
thanks, Shubhankar
You can use the Console class to write to StardardOutput which is captured by the test. For example, to dump the a/b values you supplied:
Console.WriteLine("a={0}, b={1}", a, b);
The individual data row values will now appear in Visual Studio in the Test Results window when you drill into the actual datarow results and expand the "Standard Console Output" section. In addition, if you're directly reading the TRX file this info will be in the ...InnerResults/UnitTestResult/Output/StdOut element.
精彩评论