← Back to Blog

August 21, 2018 · 5 views

Integrate Cucumber framework with QMetry

Testing Automation
Integrate Cucumber framework with QMetry

qmetry-test-management

Integrate Cucumber framework with QMetry

Introduction

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.

Entities

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 :

automation.qmetry.testrunname=test

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

1
System.setProperty("automation.qmetry.testrunname",scenario.getName());

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 “qmetry.properties” in a before hook and you will save you test result with the name what you want.

1
2
3
4
5
6
7
8
9
10
11
public static void setPropertiesForQmetry(String propertyName, String propertyValue) throws IOException {
    FileInputStream in = new FileInputStream("qmetry.properties");
    Properties props = new Properties();
    props.load(in);
    in.close();
 
    FileOutputStream out = new FileOutputStream("qmetry.properties");
    props.setProperty(propertyName, propertyValue);
    props.store(out, null);
    out.close();
}

And in hook it is look like this:

1
2
3
4
5
6
7
8
9
10
11
12
@Before(order = -2)
public void loggerConfiguration(Scenario scenario) throws IOException {
    String scenarioNameFinal = scenario.getName().replaceAll("\\s+", "-");
    scenarioNameFinal = scenarioNameFinal.concat("-" + String.valueOf(LocalTime.now().toSecondOfDay()));
    TestLogHelper.startTestLogging(scenarioNameFinal);
    logger.info("Current testname value is : " + TestLogHelper.getCurrentLogName());
    System.setProperty("automation.qmetry.testrunname",scenario.getName());
    setPropertiesForQmetry("automation.qmetry.testrunname", scenario.getName());
    logger.info(String.format("Qmetry parrameter %s was set with value: %s", "automation.qmetry.testrunname", scenario.getName()));
    setPropertiesForQmetry("automation.qmetry.platform", System.getProperty("browser"));
    logger.info(String.format("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!

Frequently Asked Questions

What is the benefit of integrating Cucumber with QMetry?

Integrating Cucumber with QMetry allows you to sync your automated BDD scenarios with a test management tool, providing better visibility, traceability, and reporting for your testing efforts.

📚 How to Cite This Article

APA Format:

I enjoy building things that live on the internet. (2018). Integrate Cucumber framework with QMetry. Steti.info. https://steti.info/blog/integrate-cucumber-framework-with-qmetry

MLA Format:

I enjoy building things that live on the internet. "Integrate Cucumber framework with QMetry." Steti.info, 21 Aug. 2018. https://steti.info/blog/integrate-cucumber-framework-with-qmetry.

Chicago Style:

I enjoy building things that live on the internet. "Integrate Cucumber framework with QMetry." Steti.info. August 21, 2018. https://steti.info/blog/integrate-cucumber-framework-with-qmetry.

Published: August 21, 2018
Last Updated: November 29, 2025

About the Author

Author
I like to build from websites to web apps, I create digital experiences that solve real problems and delight users and the most important is that all that I build, I build with PEOPLE!
Learn more about the author →

Related Posts