Import Results using Maven Plugin for QAF

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

Working Sample

Refer to Sample Projects for Automation section for a more concrete end-to-end example.

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 an API key for the 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>
             <configuration>
                <properties>
                   <property>
                      <name>listener</name>
                      <value>com.qmetry.automation.QAFResultUploader</value>
                   </property>
                </properties>
             </configuration>
          </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 <dependencies> block in pom.xml:

<dependencies>
       <dependency>
          <groupId>com.qmetry</groupId>
          <artifactId>automation</artifactId>
          <version>2.0.11</version>
       </dependency>
</dependencies>

Step 3: Add the following to the <repositories> block in pom.xml like:

<repositories>
       <repository>
          <id>qmetrytestmanager-mvn-repo</id>
          <name>QMetry Test Manager Maven Repository</name>
          <url>https://raw.github.com/qmetry/qtm4j-maven-uploader/mvn-repo/</url>
       </repository>
</repositories>

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

Configure the below properties:

Authorization: (automation.qmetry.authorization)

Maven automation is protected by the restrictions provided by JIRA. You need to log in to Jira using the "automation.qmetry.authorization" parameter. Follow the below steps to generate basic Auth and pass it to the qmetry.properties:

Option 1:

To supply a basic Auth header, perform the following steps:

1. Build a string of the form username:password

Password: Password refers to the API token generated from the API Token Authentication for Jira app.

    automation.qmetry.enabled = true
    automation.qmetry.debug = true
    automation.qmetry.url=http://qtm4j-qa-postgres-datacenter.qmetry.com/rest/qtm4j/automation/latest/importresult 
    automation.qmetry.apikey = {API Key}
    automation.qmetry.environment=env
    automation.qmetry.build=build
    automation.qmetry.attachfile=true
        automation.qmetry.matchTestSteps=true
    automation.qmetry.testCycleToReuse=NR-TR-1
        automation.qmetry.testcycle.summary=Test Cycle summary
    automation.qmetry.testcycle.labels=l1,l2,l3
    automation.qmetry.testcycle.components=c1,c2,c3
    automation.qmetry.testcycle.priority=High
    automation.qmetry.testcycle.status=To Do
    automation.qmetry.testcycle.folderPath=F1/F2/F3
    automation.qmetry.testcycle.sprintId=1242
    automation.qmetry.testcycle.fixVersionId=14234
    automation.qmetry.testcycle.description=Test Cycle description
    automation.qmetry.testcycle.assignee={Valid User Account Key}
    automation.qmetry.testcycle.reporter={Valid User Account Key}
    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=l1,l2,l3
    automation.qmetry.testcase.components=c1,c2
    automation.qmetry.testcase.priority=Medium
    automation.qmetry.testcase.status=In Progress
    automation.qmetry.testcase.folderPath=F1/F2/F3
    automation.qmetry.testcase.sprintId=34534
    automation.qmetry.testcase.fixVersionId=35345
    automation.qmetry.testcase.description=Test Case description
        automation.qmetry.testcase.precondition=Test Case precondition
    automation.qmetry.testcase.assignee={Valid User Account Key}
    automation.qmetry.testcase.reporter={Valid User Account Key}
    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}]
    automation.qmetry.authorization (For Basic)=Basic {Valid Basic Auth Token}
        automation.qmetry.authorization (For Personal Access Token)=Bearer {Valid Personal Access Token}

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 Name}}" "-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.

Publication date: