I have a couple of simple web tests that use data sources. Each web test contains only one request.
After they run it's pretty hard to detect why they failed, given that they are quite a few (80) and each has a number of rows that varies between 1 and 150.
Therefore, I used the TFS SDK to access the results programmatically, after publishing the test results to a build in TFS.
Here is the relevant part of the code:
foreach (var testRun in testRuns)
{
Console.WriteLine(string.Format("{0}", testRun.Title));
ITestCaseResultCollection testCases = testRun.QueryResults();
foreach (ITestCaseResult testcase in testCases)
{
Console.WriteLine(string.Format("{0}: {1}", testcase.TestCaseTitle, testcase.Outcome));
if (TestOutcome.Passed != testcase.Outcome)
{
Console.WriteLine(string.Format("\tNumber of iterations: {0}", testcase.Iterations.Count));
foreach (ITestIterationResult iteration in testcase.Iterations)
{
Console.WriteLine(string.Format("\t{0}: {1}", iteration.IterationId, iteration.Outcome));
}
}
}
}
The problem is that testcase.Iterations.Count is always 0. Everything else is displayed correctly. If I open the test results from Visual Studio, I can see the iterations and the details for each.
What am I missing?
Thanks.