【问题标题】:How can I update Rally test cases automatically using Cucumber and Rally integration?如何使用 Cucumber 和 Rally 集成自动更新 Rally 测试用例?
【发布时间】:2019-05-08 02:36:49
【问题描述】:

我试图弄清楚如何通过 Cucumber 自动化脚本自动更新 Rally 中测试用例的测试用例结果。我希望能够运行我的测试脚本,然后它会自动将 Rally 中的测试用例结果更新为通过或失败。

有没有办法用 Cucumber 做到这一点?我将 Cucumber 与 TestNG 和 Rest Assured 一起使用。

【问题讨论】:

    标签: java cucumber rally qaf


    【解决方案1】:

    如果您使用TestNG's QAF extension for BDD,它通过提供TestCaseResultUpdator 提供了一种使用测试管理工具integrate 测试结果的方法。在您的测试用例或场景中,您需要从测试管理工具中提供测试用例 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 自动调用,并将在单独的线程中运行,因此您的测试执行无需等待。

    【讨论】:

    • 非常感谢!我会尝试这个解决方案。许多道具给你我的好男人/女人。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多