Integrate Cucumber framework with QMetry


Integrate Cucumber framework with QMetry


Cucumber is one of the tools for running automated tests. It combines business specification and test documentation into one – which results into executable specification. Due to this collaboration, it encourages teams to keep their organization’s business goals in center.

Automated testing through Cucumber helps teams avoid heavy regressions and resultant cost.

Sample Test Result File

In order to save result in Qmetry it’s requared to save results from cucumber run in one of the following format: Supported file types : JSON, XML.


While importing result file, you can choose which level of hierarchy do you want. Test Case-Test Step or  Test Scenario-Test Case.

  1. 1st level of Entity will be identified by the pair of attributes, “uri” and “id” attributes. If it already exists, then it is not created again.
  2. 2nd level of Entity will be identified by the pair of attributes, “keyword” and “name” attributes. If it already exists, then it is not created again.

If you would like to see values for these attributes, you can verify in Automation Attributes panel of Test Case/Test Scenario issue page.


Note : By default, Automation attributes panel will be hidden. If you would want you can enable it. Refer How to enable Automation Attributes panel.

Story Association

While importing test result file, if you want us to link Test Case or Test Scenario to any of existing story then its possible.

An annotation is added to the Feature file to associate scenarios with a particular story in JIRA.


Execution Attachment

To add attachments in test run execution, you need to capture the log file and screenshots during execution of automation. The attachment file needs to be base64 encoded with mime_type in embedding tag of report file

Integration using Maven plugin

Qmetry offers possibility to import your automation results in simple steps by using maven. The official documentation to implement it you will found Import Results using Maven Plugin for Cucumber.

After this I meet a little problem, the configuration :


Is static and is took by maven plugin from the file “”, and


didn’t help me to change the name of run tests dynamically.

In this case you can create a static method what will change configuration file “” in a before hook and you will save you test result with the name what you want.

public static void setPropertiesForQmetry(String propertyName, String propertyValue) throws IOException {
    FileInputStream in = new FileInputStream("");
    Properties props = new Properties();

    FileOutputStream out = new FileOutputStream("");
    props.setProperty(propertyName, propertyValue);, null);

And in hook it is look like this:

@Before(order = -2)
public void loggerConfiguration(Scenario scenario) throws IOException {
    String scenarioNameFinal = scenario.getName().replaceAll("\\s+", "-");
    scenarioNameFinal = scenarioNameFinal.concat("-" + String.valueOf(;
    TestLogHelper.startTestLogging(scenarioNameFinal);"Current testname value is : " + TestLogHelper.getCurrentLogName());
    setPropertiesForQmetry("automation.qmetry.testrunname", scenario.getName());"Qmetry parrameter %s was set with value: %s", "automation.qmetry.testrunname", scenario.getName()));
    setPropertiesForQmetry("automation.qmetry.platform", System.getProperty("browser"));"Qmetry parrameter %s was set with value: %s", "automation.qmetry.platform", System.getProperty("browser")));

Enjoy, hope this will help you, don’t hesitate do and some comments or suggestions!