logo

NJP

Azure DevOps add new Test Type Integration via OOB API

Import · Oct 27, 2022 · article

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

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.

  4. Navigate to Test Types as DevOps --> Integration --> Test Types

  5. Create new Test Types reord

  6. Set categeory as one of Functional ,Performance or Unit

  7. AmitGujarathi_0-1666540892471.png

  8. Create new Test Type Mapping by navigating to DevOps --> Integration --> Test Type Mapping

  9. Configure the record as given below with the Tool integration defines the source from which this payload will be pushed.

  10. AmitGujarathi_1-1666541031164.png

  11. 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

  12. AmitGujarathi_2-1666541252346.png

  13. Attributes for the call is as given below

  14. Request

  15. 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>"  
    }  
    
    1. 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

View original source

https://www.servicenow.com/community/developer-articles/azure-devops-add-new-test-type-integration-via-oob-api/ta-p/2361051