Amit Gujarathi
Giga Sage
Giga Sage

Hi All,

Hope you are doing fine.

In todays article we will see how we can add a new custom test type and call the OOB DevOps API to push the payload for the same from external interfaces.

 

Symptoms

  1. Create a new Test Type called 'Infra Risk Score'
  2. Define it as a functional test unit
  3. Define the API to insert the test summary for the new test type

Diagnosis

For this we will be following the steps as given below

  1. Create new Test type
  2. Create new Test type mapping
  3. Configure the OOB API to call the same.

 

Solution

  1. Navigate  to Test Types as DevOps --> Integration --> Test Types
  2. Create new Test Types reord
  3. Set categeory as one of Functional ,Performance or Unit
  4. AmitGujarathi_0-1666540892471.png

     

  5. Create new Test Type Mapping by navigating to DevOps --> Integration --> Test Type Mapping
  6. Configure the record as given below with the Tool integration defines the source from which this payload will be pushed.
  7. AmitGujarathi_1-1666541031164.png

     

  8. Now thats it on the configuration side and now we can use the OOB Webhook | Tool API to push the Test Summary for new test type
  9. AmitGujarathi_2-1666541252346.png

     

  10. Attributes for the call is as given below
  11. Request
  12. Request
    HTTP Method  : POST 
    URI : https://<Instance name>.service-now.com/api/sn_devops/devops/tool/test?toolId=6fa7250287c38194c00c4116cebb357a&testType=Infra%20Risk%20Score
    
    Headers
    Accept : application/json
    Content-Type : application/json
    
    Request Body
    
    { 
    "name": "Test-selenium#60", 
    "duration": 78.802, 
    "passedTests": 4, 
    "failedTests": 0, 
    "skippedTests": 0, 
    "blockedTests": 0, 
    "totalTests": 4, 
    "startTime": "2020-06-30T18:12:31Z", 
    "finishTime": "2020-06-30T18:12:31Z", 
    "passingPercent": 100,
    
    "buildNumber": "30291", 
    "stageName": "<Pipeline stage name>", 
    "pipelineName": "<Azure Project Name>/<Pipeline name>"
    }
    
    
  13. Response
Response
Status code : 201 Created

Response Body
{
  "result": {
    "status": "Success",
    "sysId": null
  }
}

 

Please be sure to bookmark this article as well as mark it as Helpful if you thought it was helpful.

 

Regards,

Amit Gujarathi

Technomonk Youtube 

Amit Gujarathi Linkedin 

TheTechnomonk.com 

ServiceNow Community Amit Gujarathi 

GitHub

 

Comments
zeeshan ahmed2
Tera Contributor

Dear Amit,

 

I was working for one integration ,please see my question in the post.

 

https://www.servicenow.com/community/devops-forum/servicenow-to-azure-devops-integration/m-p/2503444

 

can i use this approach for my integration if so please provide me some steps to get started.

 

And in my API explorer i am unable to see sn_devops and devops API , please suggest

 

thanks in advance

Version history
Last update:
‎10-27-2022 01:15 AM
Updated by:
Contributors