/
Import Results using Maven Plugin for Cucumber

Import Results using Maven Plugin for Cucumber

If the automation project includes Cucumber + Java (with Maven) structure, then configure the Maven dependency in the project as described below.

Working Sample

Refer to Sample projects and Code snippets section for more concrete end-to-end examples.

Open the pom.xml and add the configurations as described on the Automation API screen for Maven. 

1. Use API Key for Importing Results

Please Generate API Key if you don't have API key for selected project. 

2. Import Results


Step 1: Add the following to the <build> -> <plugins> block in your pom.xml:

<build>
       <plugins>
          <plugin>
             <groupId>org.apache.maven.plugins</groupId>
             <artifactId>maven-surefire-plugin</artifactId>
             <version>2.22.0</version>
          </plugin>
          <plugin>
             <groupId>com.qmetry</groupId>
             <artifactId>automation</artifactId>
             <version>2.0.12</version>
             <executions>
                <execution>
                   <phase>test</phase>
                   <goals>
                      <goal>CucumberFileUpload</goal>
                   </goals>
                </execution>
             </executions>
          </plugin>
       </plugins>
</build>

Please refer to View Import Results using REST API section to view all possible request parameters.


Step 2: Add the following to the <pluginRepositories> block in pom.xml like:

<pluginRepositories>
       <pluginRepository>
          <id>qmetrytestmanager-mvn-repo</id>
          <name>QMetry Test Manager Maven Repository</name>
          <url>https://raw.github.com/qmetry/qtm4j-maven-uploader/mvn-repo/</url>
          <releases>
             <enabled>true</enabled>
             <updatePolicy>always</updatePolicy>
          </releases>
       </pluginRepository>
</pluginRepositories>

Step 3: Add qmetry.properties file to root directory of your project. Download the sample file.

Configure below properties: 

automation.qmetry.enabled = true
automation.qmetry.debug = true
automation.qmetry.url= https://qtmcloud.qmetry.com/rest/api/automation/importresult 
automation.qmetry.apikey = {{your API key}}
automation.qmetry.filepath=target/cucumber-json-report.json
automation.qmetry.environment=env
automation.qmetry.build=build
automation.qmetry.attachfile=true
automation.qmetry.matchTestSteps=true
automation.qmetry.testCycleToReuse={{Test Cycle Key}}
automation.qmetry.testcycle.summary={{Test Cycle Summary}}
automation.qmetry.testcycle.labels=lbl1,lbl2,lbl3
automation.qmetry.testcycle.components=com1,com2,com3
automation.qmetry.testcycle.priority=High
automation.qmetry.testcycle.status=Open
automation.qmetry.testcycle.sprintId=1242
automation.qmetry.testcycle.fixVersionId=14234
automation.qmetry.testcycle.folderId=1000
automation.qmetry.testcycle.description=Test Cycle description  
automation.qmetry.testcycle.assignee={Valid User Account Id} 
automation.qmetry.testcycle.reporter={Valid User Account Id}
automation.qmetry.testcycle.plannedStartDate=15/May/2020 00:00
automation.qmetry.testcycle.plannedEndDate=30/May/2020 00:00
automation.qmetry.testcycle.customFields=[{"name" : "custom field 1", "value": "high,medium,low"},{"name" : "custom field 2", "value": "29/May/2020"}]
automation.qmetry.testcase.labels=lbl1,lbl2,lbl3
automation.qmetry.testcase.components=com1,com2
automation.qmetry.testcase.priority=priority
automation.qmetry.testcase.status=status
automation.qmetry.testcase.sprintId=1242
automation.qmetry.testcase.fixVersionId=14234
automation.qmetry.testcase.folderId=1000
automation.qmetry.testcase.description=Test Case description
automation.qmetry.testcase.precondition=Test Case precondition
automation.qmetry.testcase.assignee={Valid User Account Id} 
automation.qmetry.testcase.reporter={Valid User Account Id}
automation.qmetry.testcase.estimatedTime=10:10
automation.qmetry.testcase.customFields=[{"name" : "custom field 1", "value": "high,medium,low"},{"name" : "custom field 2", "value": 10.12}]
automation.qmetry.testCaseExecution.comment = Test Case Execution Comment
automation.qmetry.testCaseExecution.actualTime = 10:10
automation.qmetry.testCaseExecution.executionPlannedDate = 16/Feb/2024
automation.qmetry.testCaseExecution.assignee = {Valid User Account Key}
automation.qmetry.testCaseExecution.customFields=[{"name" : "custom field 1", "value": "high,medium,low"},{"name" : "custom field 2", "value": 10.12}]


Once the file is configured, the automation test results will get uploaded automatically whenever the user executes the automation project (e.g. using ‘mvn test’).

As an alternate of Step 3, you can also set properties with the following command with command line arguments. You can also pass multiple command line arguments.

mvn clean test "-Dautomation.qmetry.testcycle.summary=Test Cycle Summary" "-Dautomation.qmetry.testcycle.labels=lbl1,lbl2,lbl3"

3. View imported test results

Please refer to  View Imported Test Results section to view imported test results.