5

I've got some data driven unit tests, basically done as described here:

http://msdn.microsoft.com/en-us/library/ms182527.aspx

For a given test run I can get the results with something like:

IOrderedEnumerable<ITestCaseResult> runDetails = WebApiApplication.TeamProject.TestRuns.Find(testRunId).QueryResults().OrderBy(r=>r.Outcome);

In each ITestCaseResult I can get the error message via:

testCaseResult.ErrorMessage

Great, but when there are results from a data driven test, I can't figure out how to get the iterated results. They show up in the produced .trx file, but aren't anywhere in the ITestCaseResult.

enter image description here

Any ideas on how to get them via the API?

Ben Power
  • 1,786
  • 5
  • 27
  • 35
  • This might help, though I can't believe it's that difficult: http://stackoverflow.com/questions/11436780/itestcaseresult-iterations-count-returns-0-for-a-test-with-iterations – Ben Power May 12 '14 at 04:43
  • 1
    According to this 4 year old post it is only available via the .trx file in VS2010. I can't believe this has never been fixed up! I might have to parse a 75 meg .trx file just to get it out... aaargh!! – Ben Power May 14 '14 at 23:21

1 Answers1

0

You need to tell TFS which test case to wire up each test method to. This is easy if you have a test case first as you just open the test case in VS and assign the method on the automation tab.

If you have automation first and you want to wire up 300 integration tests it is also easy, just use the "tcm import" tool to generate and sync the required test cases and test methods.

This been available since MTM was first introduced.

  • I was asking in regards to data driven testing, e.g. https://msdn.microsoft.com/en-us/library/ms182527.aspx?f=255&MSPPError=-2147217396 and can't quite see how this utility would help in this regard. – Ben Power Mar 02 '15 at 23:48