如何使用Cucumber和Rally集成自动更新Rally测试用例?

问题描述 投票:1回答:1

我试图找出如何通过Cucumber自动化脚本自动更新Rally中测试用例的测试用例结果。我希望能够运行我的测试脚本,然后将Rally中的测试用例结果自动更新为Pass或Fail。

有没有办法用黄瓜做到这一点?我正在使用Cucumber以及TestNG和Rest Assured。

java cucumber rally qaf
1个回答
1
投票

如果您正在使用TestNG's QAF extension for BDD,它通过提供integrate为测试管理工具提供了TestCaseResultUpdator测试结果的方法。在您的测试用例或场景中,您需要从测试管理工具提供测试用例ID并调用api来更新该测试用例的测试结果。 QAF支持gherkin,但gherking不支持自定义元数据。你可以使用BDD2这是一套超级小黄瓜,你的场景可能如下所示:

@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自动调用,并将在单独的线程中运行,因此您的测试执行不需要等待。

© www.soinside.com 2019 - 2024. All rights reserved.