faisalr89
faisalr89

Reputation: 23

How can I update Rally test cases automatically using Cucumber and Rally integration?

I'm trying to figure out how I can automatically update test case results for test cases in Rally through Cucumber automation scripts. I want to be able to run my test scripts, which will then update the test case results in Rally automatically to Pass or Fail.

Is there any way to do that with Cucumber? I'm using Cucumber along with TestNG and Rest Assured.

Upvotes: 1

Views: 2546

Answers (1)

user861594
user861594

Reputation: 5908

If you are using TestNG's QAF extension for BDD it provides a way to integrate your test results with test management tool by providing TestCaseResultUpdator. In your test case or scenario you need to provide test case id from test management tool and call api to update test result for that test case. QAF supports gherkin but gherking doesn't support custom meta-data. You can use BDD2 which is super set of gherkin and your scenario may look like below:

@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

In above example assume that RallyId represents test case id in test management tool. You can use it while implementing result updator.

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;
   }
}

Register your updator as below:

result.updator=example.RallyResultUpdator

Result updator will automatically called by qaf when testcase completed and will run in separate thread so your test execution need not to wait.

Upvotes: 1

Related Questions