Cloud Services

DevOps Intelligence

Bring Your Own Test
Published On Nov 05, 2024 - 1:34 PM

Bring Your Own Test

Learn how to integrate test tools to Kyndryl Modern Operations – DevOps Intelligence
As a DevOps practitioner, you may find it useful to have a centralized solution that enables you to view all your test results from various testing tools in your DevOps pipeline. This is where Test services come in - as a centralized service in DevOps Intelligence, it displays data from tools like Jenkins, Sonarqube, and more.
DevOps Intelligence Test is designed to support various testing tools and formats, giving you the flexibility to bring in tests from multiple engines. You can see an example of how DevOps Intelligence Test looks when data is populated in the image below.
It's worth noting that Test currently supports several popular testing tools, including Junit, Xunit, Cobertura, Mocha, Karmamocha, Jmeter, and LCOV. Also, if you work with different testing engines, rest assured that Test has got you covered by enabling private test tools to be integrated so that your test results will be accurately displayed in the DevOps Intelligence Test dashboard.

Bring Data into DevOps Intelligence

To bring your own Deploy tools complete the following steps:
  1. Go to the DevOps Intelligence Tools Configuration page and navigate to the Tokens tab.
  2. Click on Create Token and give a unique Token name.
  3. Select Token Type as Develop, then click on the Create button.
  4. A new entry will be added to the table. In the table entry.
  5. Click on the vertical ellipsis icon on the respective row and select the view/regenerate token option.
  6. Copy that token by clicking copy icon in the token field.
To Post Data to the APIs mentioned below, Add the service Token (see: Create Service Token) to the
Authorization
header of the request. See the cURL Example for reference

Format

Step 1: TOKEN {the-service-token-from-step1}
Example :
TOKEN 74h5cR8sETSJRvOFkdbsISY3lsgfNGu_V5aNur4Pxu1Jh8kP0NQBJhuWQsRmGzTX
Step 2:  API Reference
API : /dash/api/test/v3/technical-services/tests/{testType}
URL : https://{devops-intelligence-host}/dash/api/test/v3/technicl-services/tests/{testType}
This API will post the test data to DevOps Intelligence, as given by the test stack driver. A test report file must be uploaded while posting the data.
Service Token
is required to post the test record.
Parameters
Parameters
Type
Explanation
Example Value
technicalServiceName *
QUERY
Technical service which is going to post the data using this URL(Can be a Project Name, pipeline name,etc)
MCMP-DevOps-Intelligence/DevelopmentProject1
{testType} *
PATH
Type of test to be uploaded, it is defined according to the test which was performed(Unit, functional, code coverage)
unit
fileType *
QUERY
Type of file to be uploaded corresponding to the file to be uploaded(junit, xunit, mocha,jmeter,etc)
xunit
testEngine (optional)
QUERY
Test engine/tool name which was used to perform the test
XUNIT
uploadFile(multipart/form-data) *
FORM DATA
This is the test report file generated by the testing tool (maximum file size is 4 MB)
junit_report.xml
technicalServiceOverride
QUERY
Override flag for the technical service
true
providerhref
QUERY
Provider URL
https://provider-url
Check supported Test Types and File Formats at the end of the documentation.

cURL Example :

curl --location --request POST 'https://peer-core.gravitant.net/dash/api/test/v3/techical-services/tests/unit?fileType=xunit&testEngine=XUNIT&techncialServiceName=MCMP-DevOps-Intelligence/myservice&technicalServiceOverride=true&providerhref=https://provider-url' \ --header 'Content-Type: multipart/form-data' \ --header 'Authorization: TOKEN B8FkfCC3PRVrezteLHp0rPROs2p6yZk_swVLpP_36D7pd5HHLhx7UXqlH_BvpQGo' \ --form 'uploadfile=@/home/eshan/go/src/github.ibm.com/dash/dash_test/controller/testdata/junit_report.xml'

API : /services/tests/{testType}/run/{runID}

URL : https://{devops-intelligence-host}/dash/api/test/v3/technical-services/tests/{testType}/run/{runID}

This will post the test data for the corresponding service with a different runID (as tests may have multiple runs), as given by Test Stack Driver. A test report file must be uploaded while posting the data for a specfic run. Service token is required to post the test record.

Parameters :

Parameters
Type
Explanation
Example Value
technicalServiceName *
QUERY
Technical service which is going to post the data using this URL.(Can be a Project Name, pipeline name,etc)
MCMP-DevOps-Intelligence/MCMP-Development
{testType} *
PATH
Type of test to be uploaded, it is defined according to the test which was performed(Unit, functional, code coverage)
unit
{runID} *
PATH
This id is used as a reference while re-running a particular test and updating its record
testRun1
fileType *
QUERY
Type of file to be uploaded corresponding to the file to be uploaded(junit, xunit, mocha,jmeter,etc)
junit
testEngine(optional)
QUERY
Test engine/tool name which was used to perform the test
JUNIT
uploadfile(multipart/form-data) *
BODY
This is the test report file generated by the testing tool
junit_results.json
technicalServiceOverride
QUERY
Override flag for the technical service
true
providerhref
QUERY
Provider URL
https://provider-url
Check supported Test Types and File Formats at the end of the documentation.

cURL Example :

curl --location --request POST 'https://peer-core.gravitant.net/dash/api/test/v3/technical-services/tests/unit/run/5d8b192ac11e8a01f1493d21?fileType=xunit&testEngine=XUNIT&serviceName=MCMP-DevOps-Intelligence/dash123&serviceOverride=true&providerhref=https://provider-url' \ --header 'Content-Type: multipart/form-data' \ --header 'Authorization: TOKEN B8FkfCC3PRVrezteLHp0rPROs2p6yZk_swVLpP_36D7pd5HHLhx7UXqlH_BvpQGo' \ --form 'uploadfile=@/home/eshan/go/src/github.ibm.com/dash/dash_test/controller/testdata/junit_report_test_suite.xml'
If you don't have access to any of the test tools/engines(to generate a test result file) and have just the test data/metrics(pass/fail counts, duration,etc) Devops Intelligence Test will accept & report your data as well.
API : /dash/api/test/v3/technical-services/tests/run/{runID}/status

URL : https://{devops-intelligence-host}/dash/api/test/v3/services/tests/run/{runID}/status

This API will post the test status data corresponding to the service, this api is to be used when there maybe multiple runs for a single technical service.

Parameters :

Parameters
Type
Explanation
Example Value
tehnicalServiceName *
QUERY
Technical service which is going to post the data using this URL. (Can be a Project Name, pipeline name,etc)
MCMP-DevOps-Intelligence/JenkinsProject
{runID} *
PATH
This id is used as a reference while re-running a perticular test and updating its record
jenkinsTest1
{testEngine} (optional)
QUERY
Test engine/tool name which was used to perform the test
xunit
Request body JSON
BODY
Assign required values for each of the fields
Note: duration is expected in seconds
{"duration": 10,"failed": 2,"passed": 20,"status": "passed","test_type": "unit"}
technicalServiceOverride
QUERY
Override flag for the technical service
true

cURL Example :

curl --location --request POST 'https://peer-core.gravitant.net/dash/api/test/v3/technical-services/tests/run/fc08230e2e00d9befce356b744bf2f92d0ef20f8/status?technicalServiceName=MCMP-DevOps-Intelligence/myservice&serviceOverride=true' \ --header 'Authorization: TOKEN B8FkfCC3PRVrezteLHp0rPROs2p6yZk_swVLpP_36D7pd5HHLhx7UXqlH_BvpQGo' \ --header 'Content-Type: application/json' \ --data-raw '{ "duration": 3, "failed": 20, "passed": 25, "status": "passed", "test_type": "unit" }'

Test Types and File Types Supported :

Test Type
File Type (File Format)
Unit Test
JUnit (json), xUnit (xml), Mocha (json), KarmaMocha (json)
Function Test
JUnit (json), xUnit (xml), Mocha (json), KarmaMocha (json), JMeter(xml)
Code Coverage
Cobertura (xml), lcov, Istanbul (json), JaCoCo (xml)
Scale Test
Jmeter(xml)
Do you have two minutes for a quick survey?
Take Survey