CI/CD Rules

QTM4J provides an ability to trigger automation jobs for CI/CD tools from QTM4J application to trigger automated testing pipelines with a single click. Testers can save remote CI/CD pipeline jobs and launch the jobs directly from QTM4J. Testers can select and map a configured rule to a test cycle, then trigger the pipeline job and automate the uploading of the results after the successful execution of the job. This feature enables all testers to participate in test automation and also reduces the overhead of navigating between multiple tools by automating the testing process and reporting results.

In QTM4J, users can create and trigger the Automation Rules from Automation module and Test Cycle module. Rules added in a project are accessible by all the users of that project.

Create a CI/CD Rule in QTM4J for Jenkins

You can configure CI/CD Rules in the Automation module and Test Cycle module of QTM4J. This section describes about configuring the CI/CD Rule from the Automation module. For details about configuring CI/CD Rules from the Test Cycle module, refer to Create CI/CD Rules from Test Cycle module.

Note: QTM4J just facilitates triggering of builds to the CI/CD tools. The resultant action or outcome of triggering the build, including the import of test results back to QTM4J, is not part of the feature. Though you can import the results back to QTM4J using multiple methods when configured as part of the Job. Multiple methods are Jenkins Plugin, Maven Plugin, etc.

Steps:

1. In QTM4J, go to the Automation module.

2. Open the CI/CD Rules section.

3. Click on the Create New Rule button on the right screen.

The New Rule screen opens with the parameter fields on it.

4. Enter the following parameters to configure an automation job to be triggered in the CI/CD tool.

Parameter

Description

Parameter

Description

Name

Enter your preferred name of the rule.

Webhook URL

Enter the Webhook URL. For Jenkins, refer to How to Construct Webhook URL?

Query Params and Value

Enter required Query Param and its value.

e.g. TestCycleKey, TestCaseFolderId, TestCycleFolerId, etc.

After adding the Query Params and Value, click on the Add button after entering Query Params and its Value. The entered details will be displayed below the fields.

Headers and Value

Enter Headers and values e.g. “Authorization”. For Jenkins, refer to Authorization.

After entering Headers and Values, click on the Add button after entering Header and its Value. The entered details will be displayed below the fields.

HTTP-Method

Select HTTP-method from POST/GET/PUT.

For example, remote build trigger API for Jenkins is “POST”.

Webhook Body

Select from the options Raw/JSON/None on the drop-down and enter the Webhook Data or or request body in the field accordingly.

 

5. Click Create to save the configuration for Jenkins.

The following are examples of triggering build without params, triggering build with query parameters, and triggering build with raw parameters.

CI/CD Rule Without Parameters

 

CI/CD Rule With Query Parameters

 

CI/CD Rule With RAW Parameters

Once the CI/CD Rule is configured, you can:

  • Trigger CI/CD Rule from the Automation module

  • Trigger CI/CD Rule from the Test Cycle module

    • From Test Cycle detail page

    • From Test Cycle List View

Trigger CI/CD Rule from Automation module

You can see the configured CI/CD rules in the CI/CD Rules section of the Automation module.

Click on the Trigger icon for the rule using which you want to trigger a job in Jenkins,

The success message appears on the screen. Now check in the CI/CD tool in which the build has been triggered.

Trigger CI/CD Rule from Test Cycle module

You can create and trigger CI/CD Rules from the Test Cycle module as well. The details of CI/CD Rules will be displayed in the Audit Logs tab of the test cycle.

When a build is triggered from the test cycle, all the actions related to it are captured in the Audit Logs. It helps testers to track which CI/CD Rule was triggered from particular which test cycle.

Steps:

1. Go to the Test Cycle module.

2. Open the test cycle detail page.

3. Click on the Trigger CI/CD Rule button at the top of the screen.

 

 

The Select CI/CD Rule panel opens.

If the CI/CD Rule is not configured from the Automation module:

If you do not have the CI/CD Rule configured in the Automation module of QTM4J, and you click on the Trigger CI/CD Rule from the test case detail page, the Select CI/CD Rule panel opens blank without any records of CI/CD Rule on it. You can create CI/CD Rules from the Test Cycle module.

Create a CI/CD Rule from Test Cycle module

Steps:

1. Go to the Test Cycle module.

2. Open the test cycle details page.

3. Click on the Trigger CI/CD Rule button at the top of the screen.

The Select CI/CD Rule panel opens.

To create a new rule from the Test Cycle module, click on the Create New Rule button.

The New Rule screen opens.

Perform the same steps described in Create a New Rule in QTM4J for creating a new CI/CD Rule.

Once the rule is added, it is displayed on the Select CI/CD Rule panel of the test cycle detail page.

The same CI/CD Rule also reflects in the Automation module.

Once the CI/CD Rules are created either in the Automation module or in the Test Cycle module, you can view the summary of the configured rule in the panel.

Expand the row to view more configuration details for the rule.

The configuration details for the rule are displayed on the screen.

You can also make required changes in the configuration from this screen.

Any changes done in the CI/CD rule configuration here in the Test Cycle module will be synced in the Automation module as well.

Follow the steps mentioned below to link the CI/CD Rule with a test cycle.

1. Go to the Test Cycle module.

2. Open the test cycle details page.

3. Click on the Trigger CI/CD Rule button at the top of the screen.

The Select CI/CD Rule panel opens with the list of rules on it.

4. Select the CI/CD Rule that you want to link with the current test cycle.

The linked CI/CD Rule starts displaying on the test cycle details page at the top.

Trigger CI/CD Rule from Test Cycle

To trigger the CI/CD rule, click on the rule linked with the test cycle.

 

The CI/CD Rule name gets replaced with the Success label for a while.

Trigger CI/CD Rule from Test Cycle List View

Once linked with the test cycle, the CI/CD Rule can also be triggered for the test cycle from the list view of the Test Cycle module.

Edit CI/CD Rule from Test Cycle

You can edit the rule configuration details by clicking on the Edit icon for the linked CI/CD Rule on the test cycle detail page. Any changes done in the CI/CD Rule configuration here in the Test Cycle module will be synced in the Automation module as well.

To unlink the linked CI/CD Rule, click on the Unlink icon (X) for the Rule on test cycle detail page.

Audit Logs in Test Cycle

When a build is triggered from the test cycle, all the actions related to it are captured in the Audit Logs. It helps testers to track which CI/CD Rule was triggered from particular which test cycle.

Open the test cycle detail page and open the Audit Logs tab.

The Audit Logs tab displays all the actions carried out for the CI/CD Rules linked with the current test cycle.

View Details and History

Once the CI/CD Rule is configured, it displays in the CI/CD Rules section of the Automation module.

To view more details about the rule, click on the Key of CI/CD Rule on the screen.

The next screen opens with two tabs on it: Detail and History.

→ Detail Tab:

The Detail tab shows configuration details for that CI/CD Rule. You can also edit/delete details from the screen.

→ History Tab:

The History tab shows the audit logs for the actions performed on the CI/C Rule in Automation module as well as in all the test cycles with which the rule is linked. The details include Triggered At, User, Entity Type, Action, Description and Activity.

When a build is triggered from the test cycle, all the actions related to it are also captured in the History tab. It helps testers to track which CI/CD Rule was triggered from particular which test cycle.

Disable a CI/CD Rule

You can disable the active CI/CD Rule from the Automation module. Once the rule is disabled, it can not be selected for triggering the build to the CI/CD tool from the Automation as well as Test Cycle module. In the Automation module, the Trigger icon will not appear for the disabled/inactive rule. In the Test Cycle module, an error will be shown when you try to link a disabled/inactive rule with the test cycle.

Steps:

1. Go to the Automation module.

2. Open the CI/CD Rules section.

3. Turn the Status inactive for the rule that you want to disable.

The CI/CD Rule turns disabled/inactive.

Once the rule is disabled, it can not be selected for triggering the build to the CI/CD tool from the Automation as well as Test Cycle module.

Delete a CI/CD Rule

You can delete a CI/CD Rule from the Automation module. If the rule is linked with any of the test cycles, then its all the references with the associated test cycle will be removed on deletion of the rule.

Steps:

1. Go to the Automation module.

2. Open the CI/CD Rules section.

3. Click on the Delete icon for the rule that you want to delete.

The confirmation message pops up.

4. Click Delete to proceed.