如何将测试结果结果(failed/passed)添加到 tfs/mtm 中测试 运行 中的测试
How to add test result outcome (failed/passed ) to a test inside a test run in tfs / mtm
我创建了一个带有测试点的测试 运行,有没有办法使用 Api 标记测试 运行 中的一个测试失败/通过?
public ITestRun createRun(ITestPlan tfsPlan, IEnumerable<ITestPoint> points)
{
ITestRun run = tfsPlan.CreateTestRun(true);
foreach (ITestPoint tp in points)
{
run.AddTestPoint(tp, null);
}
run.Save();
ITestCaseResult result = run.QueryResults()[0];
result.Outcome = TestOutcome.Failed;
return run;
}
这是我的方法,但行不通。
谢谢你帮助我:-)
对于 .net api,您可以检查这种情况:How to create a test run and result using the Team Foundation Server API?
您可以考虑使用 REST API:
而不是 .net api
POST https://{instance}/DefaultCollection/{project}/_apis/test/runs/{run}/results?api-version={version}
Content-Type: application/json
{
"index": {int},
"testCaseTitle": { string },
"testCase": {
"id": { int }
},
"configuration": {
"id": { int },
"name": {string }
},
"testPoint": {
"id": { int }
},
"state": {
enum { Pending, Queued, InProgress, Paused, Completed }
},
"computerName": { string },
"resolutionState": { string },
"testCasePriority": { string },
"failureType": { string },
"automatedTestName": { string },
"automatedTestStorage": { string },
"automatedTestType": { string },
"automatedTestTypeId": { string },
"automatedTestId": { string },
"area": {
"name": {string}
},
"owner": {
"DisplayName": {string}
},
"runBy": {
"DisplayName": {string}
},
"outcome": {
enum { None, Passed, Failed, Inconclusive, Timeout, Aborted, Blocked, NotExecuted, Warning, Error, NotApplicable, Paused, InProgress}
},
"errorMessage": { string },
"comment": { string },
"startedDate": { DateTime },
"completedDate": { DateTime },
"durationInMs": { long },
"associatedWorkItems": [
{ int }
]
}
我创建了一个带有测试点的测试 运行,有没有办法使用 Api 标记测试 运行 中的一个测试失败/通过?
public ITestRun createRun(ITestPlan tfsPlan, IEnumerable<ITestPoint> points)
{
ITestRun run = tfsPlan.CreateTestRun(true);
foreach (ITestPoint tp in points)
{
run.AddTestPoint(tp, null);
}
run.Save();
ITestCaseResult result = run.QueryResults()[0];
result.Outcome = TestOutcome.Failed;
return run;
}
这是我的方法,但行不通。 谢谢你帮助我:-)
对于 .net api,您可以检查这种情况:How to create a test run and result using the Team Foundation Server API?
您可以考虑使用 REST API:
而不是 .net apiPOST https://{instance}/DefaultCollection/{project}/_apis/test/runs/{run}/results?api-version={version}
Content-Type: application/json
{
"index": {int},
"testCaseTitle": { string },
"testCase": {
"id": { int }
},
"configuration": {
"id": { int },
"name": {string }
},
"testPoint": {
"id": { int }
},
"state": {
enum { Pending, Queued, InProgress, Paused, Completed }
},
"computerName": { string },
"resolutionState": { string },
"testCasePriority": { string },
"failureType": { string },
"automatedTestName": { string },
"automatedTestStorage": { string },
"automatedTestType": { string },
"automatedTestTypeId": { string },
"automatedTestId": { string },
"area": {
"name": {string}
},
"owner": {
"DisplayName": {string}
},
"runBy": {
"DisplayName": {string}
},
"outcome": {
enum { None, Passed, Failed, Inconclusive, Timeout, Aborted, Blocked, NotExecuted, Warning, Error, NotApplicable, Paused, InProgress}
},
"errorMessage": { string },
"comment": { string },
"startedDate": { DateTime },
"completedDate": { DateTime },
"durationInMs": { long },
"associatedWorkItems": [
{ int }
]
}