I have found several samples about retrieving test results using the TFS API, but no documentation on creating results programmatically. My aim is to create a lightweight alternative to using Microsoft Test Manager for running manual tests. Does anyone have experience with this? Are there any examples out there that I'm missing?
Here's what I have so far:
ITestCaseResult CreateNewTestCaseResult(ITestSuiteEntry testCaseEntry)
{
var run = testCaseEntry.TestSuite.Plan.CreateTestRun(false /* not automated */);
run.AddTest(testCaseEntry.TestCase.Id, suiteEntry.TestSuite.DefaultConfigurations[0].Id, suiteEntry.TestSuite.Plan.Owner);
run.Save(); // so that results object is created
return run.QueryResults()[0];
}
I'm not sure if this is the correct way to initate a new run, and I'm not sure how to record results for each action of the test.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…