Integration with QTM4J 3x

Integrate QTM4J with QAS

You can upload the QAS execution results to other products of QMetry product suite - QMetry Test Management and QMetry for Jira - Test Management.

First you need to integrate QMetry Automation Studio with QMetry Test Management / QMetry for Jira - Test Management.


There are two alternate ways to access the Integration with QMetry screen:


(A) Select QMetry > Integrations.



(B) As an alternate way, open QMetry > Test Recorder. Then click on the Configuration icon above the tree.



On Integration screen, select Cloud or Server versions that you want to integrate with QAS.



Note: The QTM4J URL should be suffixed with the following to upload results in QTM4J application -

  • QTM4J URL: /rest/qtm/latest/automation/importresults


Provide integration details and save the integration.

  • Story Key: Users can link test cases executed for particular integration to a Jira Story. Enter the Story Key to which you want to link the test cases. You can view the traceability in QMetry for Jira Test Management.


Parameters

ParameterTypeRequiredDescription
Alias NamestringYesQTM4J Integration Alias Name as per user preference.
URLstringYes

QTM4J URL to upload execution test results.

Example: http://qtm4jmssql.qmetry.com:8080/rest/qtm/latest/automation/importresults

apiKey

stringYesYour API Key. API Key is unique for a specific user in a single project. The result will be imported for the project associated with the given API Key.
UsernamestringYesUsername to authenticate the login in QTM4J application.
PasswordstringYesPassword to to authenticate the login in QTM4J application.
formatstringYes

Format of result file to be imported. Supported formats:

testAssetHierarchystringNo

Level of Hierarchy : Test Scenario-Test Case Or Test Case-Test Step

testCaseUpdateLevel

numberNoTest Case update level while reusing test case, starts from 0 to 2. (This is only applicable when you use TestCase-TestStep Hierarchy option)

0 Append test steps while reusing Test Case.
1 Override test steps while reusing Test Case.
2 No change in test steps while reusing Test Case.
Default :- No change in test steps while reusing Test Case.

testRunName

stringNoName of the test run to be created. Default value: Test Run

platform

stringNoName of Platform on which test run to be executed.

labels

stringNoComma separated names of Labels to be added to the test run.

versions

stringNoComma separated names of versions to be added to the test run.
componentsstringNoComma separated names of Components to be added to the test run.
sprintstringNoName of Sprint to be added to the test run.
commentstringNoComment to be added to the test run.
Story KeystringNoThe Story Key to which you want to link the test cases executed for particular integration.
isZipbooleanNo

Pass true for ZIP upload or pass false for single file upload. Default value: false

Single test run will be created for multiple files within a zip.

testRunKeystringNoProvide Test Run key to append new results to existing Test Run.
attachFilebooleanNoPass true for attachments upload in execution. Default value: false.
JIRAFieldsJSONNoCheck specific Automation custom fields possible value and format here.


Refer to  /wiki/spaces/QTMFJC/pages/22478922 for more details on configuration parameters/wiki/spaces/QTMFJC/pages/22478922


Once you save the integration, it appears on the Integration List.



To edit the integration details, click on the Edit icon.

Modify the details and click Update to save the details.


Upload Test Results of already Executed Test Case


Else, click on the Save & Upload button to save the integration and upload the execution results into QTM4J.

To upload the execution results into QTM4J, you can also click on the Upload button on the Integration List.


Automation test suite/test cases will be created in QTM4J.

Push Test Results to QTM


Option 1. Click on the Upload option and select QTM4J.

If the integration already exists, then the integration name will appear on the list. Select the one. In the absence of saved integration, click Other and follow Option 2.

To upload automated test cases with their execution results to QTM4J 4x, click Upload.

Select QTM4J 4x on the list.



Option 2. In the absence of saved integration, click on the Upload option and select Other.

The Integration screen opens. You can add a new Integration and Save it.

You can also upload the execution directly while saving the Integration by clicking on the Save & Upload button.



The saved Integrations are displayed on the Integration list.

Click on the Upload icon for the integration to which you want to upload the test results.



The Upload Results pop-up opens.


Select either of the following options:

  • Enter or Change Test Run Key:  It will use an existing Test Run to upload test result. If Test Run Key is not mentioned while configuration, you can mention the Key here to which the test results are to be uploaded. If the Test Run Key is already mentioned while configuration, it will display here. You can change the Test Run Key, if you want.
  • Create New TestSuite and Upload Result: If the option is selected, a new test run will be created in QTM4J and the test results will be uploaded in that test run.



Confirm the upload.

The success message appears with a link to the test run which is updated with test results.



The test run is updated with test case and test execution in QTM4J as shown below.



The Test Run screen displays test case and test steps with updated execution results.



Execute Test Case/Test Suite and Upload Test Results

Scenario 1. Execute a Single Test Case

When you execute a single test case from the tree and then upload its test results to QTM4J.

Once the execution is completed, click on the Upload button.

It opens the Integration screen. Click on the Upload button for the integration.

The Upload Results pop-up opens. Select either of -

  • Enter or Change Test Run Key
  • Create New TestSuite and Upload Result

Scenario 2. Execute a Single Test Suite

When you are executing a single test suite and then upload the test results to QTM4J.



Once the execution is completed, click on the Upload button.

It opens the Integration screen. Click on the Upload button for the integration.

The Upload Results pop-up opens. Select either of -

  • Enter or Change Test Run Key
  • Create New TestSuite and Upload Result: A new test suite is created with auto-generated name and test cases added to it. The test results are uploaded accordingly.



Scenario 3. Execute All Test Suites

When you execute all test suites at once and then upload the test results to QTM4J



Once the execution is completed, click on the Upload button.

It opens the Integration screen. Click on the Upload button for the integration.

The Upload Results pop-up opens.

  • Enter or Change Test Run Key: The existing test suite with particular ID will be updated with all the test suite results.
  • Create New Individual Test Suites and Upload Result: For all the executed test suites in QAS, individual test suites will be created in QTM4J.



Execute Test Script and Upload Test Results

You can easily upload test results into QMetry Test Management for Jira and set the configuration as default. Whenever you run the automation code via CI, Command Line, test results will be pushed to system, so that you can track the details.

Either QTM Configuration or QTM4J Configuration can be set as default to upload test results at a time.


  • Set this configuration as a Default: Check the box to set the QTM4J configuration as default for uploading the test execution results whenever the test is executed using CI/CD tools. On the Integration List, the Default tag is attached to the configuration which are marked as default.


Note: If the QTM4J Configuration is set as default, then the results will be uploaded to QTM4J as and when a build is triggered through CI/CD tools.




If the QTM4J configuration is set as default, then the qmetry.properties file, under the resources directory (resources/qmetry.properties), will auto populate the configuration details.


The following is the code snippet of qmetry.properties file.


Code Snippet
#This properties file contains qtm/1tm4j server/cloud related information
#as per requirement modified it.automation.qmetry.enabled=true
automation.qmetry.type=QTM4J
automation.qmetry.onpremise=false
automation.qmetry.url=https://importresults.qmetry.com/prod/importresults-qtm4j
automation.qmetry.apikey=1113a6996548e2f94a71f4535015edcd2d467df648f5e8c0a78
automation.qmetry.platform=
automation.qmetry.testassethierarchy=
automation.qmetry.testcaseupdatelevel=
automation.qmetry.testrunname=
automation.qmetry.labels=
automation.qmetry.version=
automation.qmetry.components=
automation.qmetry.sprint=
automation.qmetry.comment=
automation.qmetry.testrunkey=
automation.qmetry.attachfile=
automation.qmetry.jirafields=
automation.qmetry.debug=false


Steps to Upload Test Results to default QTM4J


1. Record test case and export.



2. qmetry.properties file:Set configuration details.

If the QTM4J configuration is set as default, then the qmetry.properties file, under the resources directory (resources/qmetry.properties), will auto populate the configuration details.



3. Open the application.properties file and set webdriver path.



4. Open terminal and run command: mvn clean test

It will run the exported test case in the browser whose driver path is set in the application.properties file as per Step 3.


5. Success message is displayed once the results are uploaded to QTM4J.

Click on the testRunUrl to open the QTM4J test run in the browser.

You can see the test execution results on the execution screen.