Jenkins - 显示失败测试的名称 TestNG

问题描述 投票:0回答:2

在我的 Jenkinsfile 中,我将所有测试结果计算为

AbstractTestResultAction testResultAction = currentBuild.rawBuild.getAction(AbstractTestResultAction.class)
    if (testResultAction != null) {
        def total = testResultAction.totalCount
        def failed = testResultAction.failCount
        def skipped = testResultAction.skipCount
        def passed = total - failed - skipped

但我也想显示松弛消息中失败测试的所有名称。 到目前为止,我尝试使用

def failedTests = testResultAction.getResult().getFailedTests()
生成它,但它返回的不是像
hudson.tasks.junit.CaseResult@37e0fb97
这样的特定名称。 有没有办法显示测试的全名?我正在使用 Selenium + TestNG。

selenium jenkins jenkins-pipeline testng slack
2个回答
1
投票

您可以使用

.getTitle()
方法获取描述:

def failedTests = testResultAction.getResult().getFailedTests().collect { it.getTitle() }

0
投票

对我来说,URL 在

.com
之后被删除,仅在此
.com
出现在标题中之前

示例:

<td>${packageResult.collect { it.getTitle()}}</td>

这里的输出是:

[Test Result : https://axiom.amazon]

但我需要:

https://axiom.amazon.com/#/reports/event/17291232
© www.soinside.com 2019 - 2024. All rights reserved.