Execution Callbacks

Callbacks are used in cases where you have multiple tests to execute as a batch after which you may want to notify or do something with the result using a REST Connection. For example, you can post the results on a dashboard or add them to a JIRA ticket for everyone to see. 

1- Before setting up your REST Callbacks, create an execution set, add test cases and prepare anything else you need.

2- Click Notifications tab. In Callbacks section, click on the dropdown list next to Condition where you can select when the Callback will be performed. Here are the available options:

A. None: no callbacks will be performed

B. Any: callbacks will be performed regardless of any events happening (execution passes or fails or times out)

C. Success: callbacks will be performed only when execution is successful

D. Failure: callbacks will be performed only when execution has failed

E. Timeout: callbacks will be performed in the case of execution timeout

3- In the dropdown list next to Level, select the level at which the Callback will be performed:

A. Execution: Allows you to use variables dedicated for execution details where these details are needed to be sent after the execution has completed.

B. Test Case: Allows you to use variables dedicated for test case details where these details are needed to be sent after all test cases have completed executing.

4- Click Add/View to create your REST connection which will be performed after execution.

5- Enter a name for your REST Connection, your URL and your authentication if it’s required. Afterwards, select POST under REST Options.

6- Click +Add next to headers if you would like to add headers (For example, Content-Type = application/json).

7- In the Payload section, click Plain Text and you can start adding any of the dynamic variables below depending on the Level you selected in the Execution Set screen. For easier identification, the labels were added ahead of the variables:

 

Test Case Level Variables:

Test Case Name: @test_case_name

Test Case Suite Name: @test_case_suite_name

Test Case Execution ID: @test_case_execution_id

Test Case Description: @test_case_description

Test Case Execution Start Timestamp: @test_case_execution_start_timestamp

Test Case Execution End Timestamp: @test_case_execution_end_timestamp

Test Case Execution Video URL: @test_case_execution_video_url

Test Case Execution Image URL: @test_case_execution_image_url

Test Case Execution Log URL: @test_case_execution_log_url

Test Case Execution Status: @test_case_execution_status

Test Case Execution Duration: @test_case_execution_duration

Test Case Execution Actual Duration: @test_case_execution_actual_duration

Test Case Execution Start Date/Time: @test_case_execution_start_date_time

Test Case Execution End Date/Time: @test_case_execution_end_date_time

Test Case Execution Failed Messages: @test_case_execution_failed_messages

Test Case Execution Defect Tracking ID: @test_case_execution_defect_tracking_id

 

Execution Level Dynamic Variables:

Execution Passed on Retry: @execution_passed_on_retry

Execution Build: @execution_build

Execution State: @execution_state

Execution Pending: @execution_pending

Execution Failed: @execution_failed

Execution Total: @execution_total

Pass Rate: @pass_rate

Execution Result: @execution_result

Execution Set ID: @execution_set_id

Execution ID: @execution_id

Execution Set Name: @execution_set_name

 

9- If you would like to have a custom date/time format for variables @test_case_execution_start_date_time or @test_case_execution_end_date_time, you can go to Administration > Account Preferences where you will be able to enter a custom format as below:

For example, yyyy-MM-dd'T'hh:mm:ss.ms will generate: 2020-10-06T09:43:26.4326 where the T is constant.

10- Save your REST Connection which will now take you back to Execution Sets screen.

11- Click Save and cloud run your set or start its schedule so that it starts at the determined schedule.

12- Once execution is completed, you can check your endpoint to see the results.

13- Sample endpoint response:

 

Callback Results

  1. In order to check your execution callback results, navigate to the Execution Results (you can do so by clicking on the link of the execution set under Execution Sets page - or by going to Reporting > Execution Results and filtering for your execution set)

  2. Click on the additional details icon under State column.

  3. Next to Callback Results, click 3 dots

  4. You will now be able to see all performed callbacks, including the Condition, Level, REST Connection name, Status Code and Details of the Request and Response.

  5. By clicking on the link under Rest Connection, you will be directed to the Rest Connection you created where you specified your dynamic variable names.

  6. By clicking on the link under Request, you will be directed to a window which shows what your Payload will look like after resolving the variable names.

  7. By clicking on the Response link, you will be directed to a window which shows you the response of the server. This is mainly the window which will assist you in case your callback has failed and you can review what needs to be fixed.

 

 

Related pages