admin管理员组文章数量:1122832
I am using the api url POST /{organization}/{project}/_apis/test/Runs/{runId}/results?api-version=7.1
which is mentioned on this page .1&tabs=HTTP#testsubresult
to create a test case result
i am creating the result using the TestCaseResult[]
and successfully being able to see the result on azure devops
the only problem is that i am not able to get the details part filled in any way. I have the stack trace filled, the error message filled.. but the details should show the steps executed which would be shown in case i am creating a bug from this
This is the code i am using:
listOf(
TestCaseResultRequestBody(
automatedTestName = testCaseResult.title,
testRun = ShallowReferenceString(testRunId),
durationInMs = testCaseResult.testCaseResult.duration.toMillis(),
state = "Completed",
outcome = testCaseResult.status.lowercase().capitalize(),
testCase = ShallowReference(testCaseResult.workItemMeta.Id.toInt(), name = testCaseResult.annotatedTitle),
testPlan = ShallowReferenceString(testPlanId),
testPoint = ShallowReferenceString(testPointId),
testCaseRevision = testCaseResult.workItemMeta.Revision.toInt(),
testCaseTitle = testCaseResult.annotatedTitle,
comment = "test",
stackTrace = testCaseResult.stackTrace,
errorMessage = if (testCaseResult.failureMessage.isEmpty()) {
null
} else {
val failure = testCaseResult.steps.map {
"${it.status.name}: "+it.stepDescription
}.joinToString("\n")
failure
}
)
}
)
val jsonPayload = JsonConfig.json.encodeToString(ListSerializer(TestCaseResultRequestBody.serializer()), testCaseResults)
val client = HttpClient.newHttpClient()
val request = httpRequestBuilder("$AZURE_BASE_URL/test/runs/$testRunId/results?api-version=7.1")
.POST(HttpRequest.BodyPublishers.ofString(jsonPayload))
.build()
val response = client.send(request, HttpResponse.BodyHandlers.ofString())
本文标签: Create Test Case Result using Azure DevOps APIStack Overflow
版权声明:本文标题:Create Test Case Result using Azure DevOps API - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736305321a1932551.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论