Execution Set Callback updating a JIRA ticket

In this article, we will explore how we can make a REST call back at the completion of an execution set. In this example, our callback is basically commenting on a JIRA ticket. The JIRA ticket is dynamically passed to the Subject7 platform using a parameter and then this parameter is used in REST connection artifact. 

 

1. Create a REST connection to comment on a JIRA ticket. Go to the Artifacts menu and select REST connections and fill out the form like the picture below. Make sure you do NOT use any non-alphanumeric characters in any of the fields. Basically no dashes or underscores and other characters. 

mceclip0.png

You can use the following dynamic reserved variables in the body of the call to update the ticket. 

For the execution level, here are the dynamic variables that can be used in the Rest Connection callback:

@pass_rate

@execution_total
@execution_passed_on_retry
@execution_failed
@execution_skipped
@execution_pending
@execution_build
@execution_state
@execution_result
@execution_set_id
@execution_id

For the test case level, here are the dynamic variables that can be used in the Rest Connection callback:

@test_case_execution_id
@test_case_execution_video_url
@test_case_execution_image_url
@test_case_execution_log_url
@test_case_execution_status
@test_case_execution_duration
@test_case_execution_defect_tracking_id
@test_case_execution_failed_messages

 

NOTE: The dynamic variables of each level (execution and Test Case) correspond to just that level. For example, you cannot use @pass_rate and select Test Case as level. 

 

2. Configure Execution Set Callback. Browse to the Execution Set of your choice and in the callback section choose condition "Any" and then for Rest choose "jira_add_comment". You can also choose at which event/level you want the callback to occur. Either execution level (when All tests are executed) or at test case level (a call after each test execution). 

mceclip1.png

 

3. Use your preferred REST tool to invoke the execution set. Here is the curl example: 

 

curl -X POST "https://platform.subject-7.com/api/v2/executions" -H "accept: application/json" -H "authorization: Basic c3ViamVjdDdfYdRtaW46Y1hhbmdlbGZ0ZQI1MQ==" -H "Content-Type: application/json" -d "{ \"name\": \"EXECUTION_SET_NAME\", \"configuration\": { \"callbackArgs\": \"jiraAddCommentURL=https://mycompany.atlassian.net/rest/api/latest/issue/ISSUE-2777/comment,text=Execution Completed.\" }}"

 

 

 

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

Please sign in to leave a comment.