Back to QMetry All Products Help Page
How to import Results using Maven Plugin for TestNG?
If the automation project includes Cucumber + Java (with Maven) structure, then configure the Maven dependency in the project as described below.
Working Sample
Please look at Sample projects and Code snippets sections 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 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>1.0.2</version> <executions> <execution> <phase>test</phase> <goals> <goal>TestngFileUpload</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:
<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.url = http://qtm4jpostgres.qmetry.com:8080/rest/qtm/latest/automation/importresults automation.qmetry.apikey = {{your API key}} automation.qmetry.filepath = /target/surefire-reports/testng-results.xml automation.qmetry.testrunname = Test Run automation.qmetry.labels = lbl1,lbl2 automation.qmetry.components = com1,com2 automation.qmetry.version = v1,v2 automation.qmetry.sprint = sprint1 automation.qmetry.platform = chrome automation.qmetry.comment = this is test run comment automation.qmetry.testrunkey = automation.qmetry.testassethierarchy = TestCase-TestStep automation.qmetry.jirafields = automation.qmetry.debug = true automation.qmetry.testcaseupdatelevel=2 automation.qmetry.attachfile=true
If you are using on premise JIRA, then configure below properties as well:
automation.qmetry.authorization=Basic YWRtaW46YWRtaW4= OR automation.qmetry.username=admin automation.qmetry.password=admin
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’).
3. View imported test results
Please refer to View Imported Test Results section to view imported test results.
Back to QMetry All Products Help Page