我试图弄清楚如何通过 Cucumber 自动化脚本自动更新 Rally 中测试用例的测试用例结果。我希望能够运行我的测试脚本,然后该脚本将自动将 Rally 中的测试用例结果更新为“通过”或“失败”。
有什么办法可以用 cucumber 做到这一点吗?我将 Cucumber 与 TestNG 和 Rest Assured 一起使用。
最佳答案
如果您使用TestNG's QAF extension for BDD它提供了一种方法integrate通过提供TestCaseResultUpdator
,您可以使用测试管理工具获得测试结果。在您的测试用例或场景中,您需要从测试管理工具提供测试用例 ID,并调用 api 来更新该测试用例的测试结果。 QAF 支持 gherkin但 gherking 不支持自定义元数据。您可以使用BDD2这是小 cucumber 的 super 集合,您的场景可能如下所示:
@smoke @RallyId:TC-12345
Scenario: A scenario
Given step represents a precondition to an event
When step represents the occurrence of the event
Then step represents the outcome of the event
在上面的示例中,假设RallyId
表示测试管理工具中的测试用例 ID。您可以在实现结果更新器时使用它。
package example;
...
public class RallyResultUpdator implements TestCaseResultUpdator{
@Override
public String getToolName() {
return "Rally";
}
/**
* This method will be called by result updator after completion of each testcase/scenario.
* @param params
* tescase/scenario meta-data including method parameters if any
* @param result
* test case result
* @param details
* run details
* @return
*/
@Override
public boolean updateResult(Map<String, ? extends Object> metadata,
TestCaseRunResult result, String details) {
String tcid = metadata.get("RallyId");
// Provide test management tool specific implemeneation/method calls
return true;
}
}
按如下方式注册您的更新程序:
result.updator=example.RallyResultUpdator
当测试用例完成时,结果更新器将由 qaf 自动调用,并将在单独的线程中运行,因此您的测试执行无需等待。
关于java - 如何使用 Cucumber 和 Rally 集成自动更新 Rally 测试用例?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55595383/