TFS-C# integration. Not able to update test result history
In TFS, we are able to update the test result through TFS API but not able to update the test result history in TFS
Code:
foreach (ITestCaseResult result in results)
{
if (result.TestCaseId == 15)
{
iterationResult = result.CreateIteration(1);
MessageBox.Show(iterationResult.ToString());
foreach (ITestStep testStep in result.GetTestCase().Actions)
{
ITestStepResult stepResult = iterationResult.CreateStepResult(testStep.Id);
stepResult.Outcome = TestOutcome.Passed;//you can assign different states here
iterationResult.Actions.Add(stepResult);
}
iterationResult.Outcome = TestOutcome.Passed;
result.Iterations.Add(iterationResult);
result.Outcome = TestOutcome.Passed;
string TCresult = result.Outcome.ToString();
if (TCresult == "Failed")
{
AddAttachment();
}
}
}
results.Save(true);
testRun.Save();
testRun.Refresh();