# Atlassian Jira Integration
In this article, we will look at, how we can integrate Atlassian Jira Software Server or Jira Cloud with vREST NG. This integration will automatically log defects in the Atlassian Jira instance on API test failures.
Table of Contents:
# How this integration works?
Let's briefly look at, how this integration actually works:
- Import the desired built-in template for this integration.
- This integration adds a
Post Test Case Iteration Hook
which will be executed whenever a test case is failed. And the defect will be logged in the configured Jira instance.
Now, let's see the step-by-step instructions on how you may integrate Atlassian Jira with vREST NG Application.
# Step 1: Import the Atlassian Jira Integration Template
Now, just visit the Hooks tab in vREST NG Application and click on the "Show Built-in Integrations" option available at the bottom in the left pane. It will show all the available integrations. Just select the desired integration and click on the Import
button.
# Step 2. Understand the data which is imported
Let's review the data which is imported by this import process. You may skip this step if you don't want to see the details. We will continuously improve our integrations based on user feedback. In this step, we will also mention the impact of re-import of the integration. You may safely remove any of the integration files and re-import them. However, if you have done any customizations then you may need to do it again if you delete the files.
File Path | Remarks |
---|---|
authorizations/jira_basic_auth.json |
|
environments/default.json | This file will be updated with some integration-specific variables. If some of the variables already exist then they won't be changed. |
hooks/log_jira_defect_on_test_failure.json | Post Test Case Iteration Hook to automatically log the defects in Atlassian Jira on test failures. If a file with this name already exists then the import process will not change the contents of this file. |
utilities/getJiraIssueDescriptionForTestFailure.js | Utility Method for generating the description field for Jira bug on API Test failure. If a file with this name already exists then the import process will not change the contents of this file. |
hooks.json | Hooks file to configure the desired hooks for the integration. |
# Step 3: Configure the global variables
Now, just visit the Environment/Variables
section in the Configuration
tab and configure the following variables which the import process has just defined.
Variable Name | Description |
---|---|
jiraBaseURL | Base URL of your Atlassian Jira Server or Jira Cloud instance. |
jiraUsername |
|
jiraApiToken |
|
jiraProjectKey | Project Key of the project in which you want to log the defect. |
jiraAssigneeName |
|
jiraHookEnv | Provide the environment name in which you would like to execute this hook. For testing purposes, you may use the value default or whatever environment you are using for your local test development. |
# Step 4: Customizing the hook
Although, you may customize every part of this hook as per your needs. But specifically, you would be interested in changing the following:
- For changing the description field format, check
Utility Methods
>>getJiraIssueDescriptionForTestFailure
. - For customizing the API Request for Jira, check
Hooks
>>Post Test Case Iteration Hooks
>>Log JIRA Issue on Test Failure
>>Request
>>Body
.
# Step 5: Verifying the Integration
To verify the integration, simply execute some of the tests, at least one of them should fail. Make sure you are executing them in an environment as per the configured hook condition.
Now see the result for a failed test case and Open the Hooks sub-tab for that test case. If you see the green signal for the Jira hook then your integration is working fine. You may also verify the integration by looking at the defect logged in Atlassian Jira.
That's it. If you face any issues in this integration. Feel free to reach out to us at support@vrest.io
.