Import test result only
POST /ds/test-executions/testng
Parameters and request body
Param | Type | Required | Description |
---|
projectKey | string |
| Key of the project where test result will be imported. |
milestoneId | integer | | Milestone id to link to Test execution.
To retrieve Milestone id go to Milestone feature and click Copy Id. Check out Milestone Document.
|
testExecutionKey | string | | Test execution key to import test report. |
testPlanKeys | array[string] | | Test plan key to import test report. If you specify the Test Plan, the Tests will be added automatically to the Test Plan if they're not part of it. |
testEnvironments | array[string] | | A string containing a list of test environments separated by ",". |
fixVersions | array[string] | | A string containing a list of fixVersions separated by “,”. |
revision | string | | Revision to link to Test execution. |
Request body will contain a XML file which is TestNG report that is going to be imported. Learn more about TestNG testing framework.
Example
BASH
curl -X 'POST' \
'https://api.agiletest.app/ds/test-executions/testng?projectKey=ATP' \
-H 'accept: application/json' \
-H 'Authorization: JWT <token>' \
-H 'Content-Type: application/xml' \
--data-binary '@my-report.xml'
In that, <token> is the result from previous step Get Authenticated.
Test result example
XML
<?xml version="1.0" encoding="UTF-8"?>
<testng-results ignored="0" total="24" passed="24" failed="0" skipped="0">
<reporter-output>
</reporter-output>
<suite started-at="2024-11-06T07:52:04 ICT" name="Surefire suite" finished-at="2024-11-06T07:52:04 ICT" duration-ms="31">
<groups>
</groups>
<test started-at="2024-11-06T07:52:04 ICT" name="Surefire test" finished-at="2024-11-06T07:52:04 ICT" duration-ms="31">
<class name="ProductTest">
<test-method signature="testIsInStock()[pri:0, instance:ProductTest@4c402120]" started-at="2024-11-06T07:52:04 ICT" name="testIsInStock" finished-at="2024-11-06T07:52:04 ICT" duration-ms="0" status="PASS">
<reporter-output>
</reporter-output>
</test-method> <!-- testIsInStock -->
<test-method signature="testRestock()[pri:0, instance:ProductTest@4c402120]" started-at="2024-11-06T07:52:04 ICT" name="testRestock" finished-at="2024-11-06T07:52:04 ICT" duration-ms="0" status="PASS">
<reporter-output>
</reporter-output>
</test-method> <!-- testRestock -->
<test-method signature="testGetPrice()[pri:0, instance:ProductTest@4c402120]" started-at="2024-11-06T07:52:04 ICT" name="testGetPrice" finished-at="2024-11-06T07:52:04 ICT" duration-ms="0" status="PASS">
<reporter-output>
</reporter-output>
</test-method> <!-- testGetPrice -->
</class> <!-- ProductTest -->
<class name="CartServiceTest">
<test-method signature="testCheckoutCart()[pri:0, instance:CartServiceTest@22ff4249]" started-at="2024-11-06T07:52:04 ICT" name="testCheckoutCart" finished-at="2024-11-06T07:52:04 ICT" duration-ms="0" status="PASS">
<reporter-output>
</reporter-output>
</test-method> <!-- testCheckoutCart -->
<test-method signature="testCreateCart()[pri:0, instance:CartServiceTest@22ff4249]" started-at="2024-11-06T07:52:04 ICT" name="testCreateCart" finished-at="2024-11-06T07:52:04 ICT" duration-ms="0" status="PASS">
<reporter-output>
</reporter-output>
</test-method> <!-- testCreateCart -->
<test-method signature="testGetCart()[pri:0, instance:CartServiceTest@22ff4249]" started-at="2024-11-06T07:52:04 ICT" name="testGetCart" finished-at="2024-11-06T07:52:04 ICT" duration-ms="0" status="PASS">
<reporter-output>
</reporter-output>
</test-method> <!-- testGetCart -->
</class> <!-- CartServiceTest -->
<class name="BillingTest">
<test-method signature="testValidatePayment()[pri:0, instance:BillingTest@2d1ef81a]" started-at="2024-11-06T07:52:04 ICT" name="testValidatePayment" finished-at="2024-11-06T07:52:04 ICT" duration-ms="1" status="PASS">
<reporter-output>
</reporter-output>
</test-method> <!-- testValidatePayment -->
<test-method signature="testCalculateFinalAmount()[pri:0, instance:BillingTest@2d1ef81a]" started-at="2024-11-06T07:52:04 ICT" name="testCalculateFinalAmount" finished-at="2024-11-06T07:52:04 ICT" duration-ms="0" status="PASS">
<reporter-output>
</reporter-output>
</test-method> <!-- testCalculateFinalAmount -->
</class> <!-- BillingTest -->
<class name="DeliveryOptionTest">
<test-method signature="testGetCost()[pri:0, instance:DeliveryOptionTest@1165b38]" started-at="2024-11-06T07:52:04 ICT" name="testGetCost" finished-at="2024-11-06T07:52:04 ICT" duration-ms="0" status="PASS">
<reporter-output>
</reporter-output>
</test-method> <!-- testGetCost -->
<test-method signature="testToString()[pri:0, instance:DeliveryOptionTest@1165b38]" started-at="2024-11-06T07:52:04 ICT" name="testToString" finished-at="2024-11-06T07:52:04 ICT" duration-ms="0" status="PASS">
<reporter-output>
</reporter-output>
</test-method> <!-- testToString -->
<test-method signature="testGetOptionName()[pri:0, instance:DeliveryOptionTest@1165b38]" started-at="2024-11-06T07:52:04 ICT" name="testGetOptionName" finished-at="2024-11-06T07:52:04 ICT" duration-ms="0" status="PASS">
<reporter-output>
</reporter-output>
</test-method> <!-- testGetOptionName -->
</class> <!-- DeliveryOptionTest -->
<class name="DeliveryTest">
<test-method signature="testGetDeliveryDetails()[pri:0, instance:DeliveryTest@5b12b668]" started-at="2024-11-06T07:52:04 ICT" name="testGetDeliveryDetails" finished-at="2024-11-06T07:52:04 ICT" duration-ms="5" status="PASS">
<reporter-output>
</reporter-output>
</test-method> <!-- testGetDeliveryDetails -->
<test-method signature="testSetDeliveryDate()[pri:0, instance:DeliveryTest@5b12b668]" started-at="2024-11-06T07:52:04 ICT" name="testSetDeliveryDate" finished-at="2024-11-06T07:52:04 ICT" duration-ms="0" status="PASS">
<reporter-output>
</reporter-output>
</test-method> <!-- testSetDeliveryDate -->
<test-method signature="testSetDeliveryAddress()[pri:0, instance:DeliveryTest@5b12b668]" started-at="2024-11-06T07:52:04 ICT" name="testSetDeliveryAddress" finished-at="2024-11-06T07:52:04 ICT" duration-ms="0" status="PASS">
<reporter-output>
</reporter-output>
</test-method> <!-- testSetDeliveryAddress -->
</class> <!-- DeliveryTest -->
<class name="AddressTest">
<test-method signature="testGetFullAddress()[pri:0, instance:AddressTest@327514f]" started-at="2024-11-06T07:52:04 ICT" name="testGetFullAddress" finished-at="2024-11-06T07:52:04 ICT" duration-ms="0" status="PASS">
<reporter-output>
</reporter-output>
</test-method> <!-- testGetFullAddress -->
<test-method signature="testAddressInequality()[pri:0, instance:AddressTest@327514f]" started-at="2024-11-06T07:52:04 ICT" name="testAddressInequality" finished-at="2024-11-06T07:52:04 ICT" duration-ms="0" status="PASS">
<reporter-output>
</reporter-output>
</test-method> <!-- testAddressInequality -->
<test-method signature="testAddressEquality()[pri:0, instance:AddressTest@327514f]" started-at="2024-11-06T07:52:04 ICT" name="testAddressEquality" finished-at="2024-11-06T07:52:04 ICT" duration-ms="0" status="PASS">
<reporter-output>
</reporter-output>
</test-method> <!-- testAddressEquality -->
</class> <!-- AddressTest -->
<class name="ProductServiceTest">
<test-method signature="testAddProduct()[pri:0, instance:ProductServiceTest@22555ebf]" started-at="2024-11-06T07:52:04 ICT" name="testAddProduct" finished-at="2024-11-06T07:52:04 ICT" duration-ms="2" status="PASS">
<reporter-output>
</reporter-output>
</test-method> <!-- testAddProduct -->
<test-method signature="testUpdateProduct()[pri:0, instance:ProductServiceTest@22555ebf]" started-at="2024-11-06T07:52:04 ICT" name="testUpdateProduct" finished-at="2024-11-06T07:52:04 ICT" duration-ms="0" status="PASS">
<reporter-output>
</reporter-output>
</test-method> <!-- testUpdateProduct -->
</class> <!-- ProductServiceTest -->
<class name="DeliveryServiceTest">
<test-method signature="testAddDeliveryOption()[pri:0, instance:DeliveryServiceTest@4c12331b]" started-at="2024-11-06T07:52:04 ICT" name="testAddDeliveryOption" finished-at="2024-11-06T07:52:04 ICT" duration-ms="0" status="PASS">
<reporter-output>
</reporter-output>
</test-method> <!-- testAddDeliveryOption -->
<test-method signature="testGetAvailableOptions()[pri:0, instance:DeliveryServiceTest@4c12331b]" started-at="2024-11-06T07:52:04 ICT" name="testGetAvailableOptions" finished-at="2024-11-06T07:52:04 ICT" duration-ms="0" status="PASS">
<reporter-output>
</reporter-output>
</test-method> <!-- testGetAvailableOptions -->
</class> <!-- DeliveryServiceTest -->
<class name="CartTest">
<test-method signature="testGetTotalPrice()[pri:0, instance:CartTest@7586beff]" started-at="2024-11-06T07:52:04 ICT" name="testGetTotalPrice" finished-at="2024-11-06T07:52:04 ICT" duration-ms="1" status="PASS">
<reporter-output>
</reporter-output>
</test-method> <!-- testGetTotalPrice -->
<test-method signature="testAddItem()[pri:0, instance:CartTest@7586beff]" started-at="2024-11-06T07:52:04 ICT" name="testAddItem" finished-at="2024-11-06T07:52:04 ICT" duration-ms="0" status="PASS">
<reporter-output>
</reporter-output>
</test-method> <!-- testAddItem -->
<test-method signature="testRemoveItem()[pri:0, instance:CartTest@7586beff]" started-at="2024-11-06T07:52:04 ICT" name="testRemoveItem" finished-at="2024-11-06T07:52:04 ICT" duration-ms="0" status="PASS">
<reporter-output>
</reporter-output>
</test-method> <!-- testRemoveItem -->
</class> <!-- CartTest -->
</test> <!-- Surefire test -->
</suite> <!-- Surefire suite -->
</testng-results>
Output example
JSON
{
"id": "321016",
"key": "ATP-1856",
"url": "https://company.atlassian.net/browse/ATP-1856"
}
Import test result with new execution details
POST /ds/test-executions/testng/multipart
Parameters and request body
This request does not require any parameters. Instead, you need to submit two separate files: one containing the test execution details and the other containing the imported test report.
Test Execution file structure
fields
object:
summary
: Summary of Test execution issue that will be created.
project.id
: Project id in which the Test execution will be created.
issuetype.id
: The identifier specifying the type of issue to be created.
agileTestFields
object:
Each of these fields serves a specific purpose in creating and organizing the test execution:
The fields
object contains standard issue creation information like what project it belongs to and what type of issue it is.
The agileTestFields
object contains Agile Test-specific information for linking the execution to milestones and test plans.
Example
BASH
curl -X 'POST' \
'https://api.agiletest.app/ds/test-executions/testng/multipart' \
-H 'accept: application/json' \
-H 'Authorization: JWT <token>' \
-H 'Content-Type: multipart/form-data' \
-F 'results=@my-report.xml;type=application/xml' \
-F 'testExecution=@test-execution.json;type=application/json'
In that, <token> is the result from previous step Get Authenticated.
Regarding the test result, we will reuse the previous example.
Test execution details
JSON
{
"fields": {
"summary": "Regression test",
"project": {
"id": "17110"
},
"issuetype": {
"id": "16396"
}
},
"agileTestFields": {
"milestoneId": 5555,
"testPlanKeys": ["ATP-364", "ATP-362"]
}
}
In this example, make sure all details provided are accurate and relevant; otherwise, the request will fail. For example, if the issuetype.id
you specify does not exist in the project with ID 17110
, the system will return an error with the corresponding error code 400 .
Output example
JSON
{
"id": "321348",
"key": "ATP-1859",
"url": "https://company.atlassian.net/browse/ATP-1859"
}
Should you need any assistance or further AgileTest inquiries, contact here!