groovy - runner.results do not provide results in sequence of test run
问题描述
I want to get status of testcases run in a testsuite using teardown scripts. I am able to get the status but not in the sequence of the run of testcases.
I am getting results in random order. The names are in random order everytime.
for ( testCaseResult in runner.results )
{
log.info "$testCaseName"
}
解决方案
每当我这样做时,我都会按照正确的顺序排列它们......
您可能想尝试这样的事情:
// In this manner, I would expect you to get the testcases in correct order
for (def tc in runner.testSuite.testCaseList) {
// Now loop through the results in order to get the result for the current tc
for (def tcRunner in runner.results) {
def matchFound = false
if (tcRunner.testCase.name.equals(tc.name)) {
matchFound = true
// do your thing
}
if (!matchFound) {
// Do whatever you want to do, if the specific testresult was not found.
}
}
}
推荐阅读
- android - 开闭原理及扩展功能
- django - Django 防止并发创建对象
- apache-spark - 每次我运行与样本相关的内容时,Spark 都会重新采样我的数据
- php - Laravel SQL 问题 SQLSTATE[HY000] [1045] 访问被拒绝
- database - 如何使用 JaguarDB 存储几何对象
- linux - 仅从 Bash 中的 JSON 文件中提取一些键
- kubernetes - 版本 \"v1\" 中的 KubernetesPodOperator Pod 无法作为 Pod 处理:v1.Pod.Spec
- sqoop - Sqoop 导入按列拆分,不同的数据库拆分该数据
- javascript - 在 2 个单独的数组上执行相同的过滤器和映射功能
- c# - 在 ASP.NET Web API 中禁用模型验证 [必需]