Import test result only
POST /ds/test-executions/nunit
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 NUnit report that is going to be imported. Learn more about NUnit testing framework.
Example
BASH
curl -X 'POST' \
'https://api.agiletest.app/ds/test-executions/nunit?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"?>
<TestRun id="8860d293-d5f2-426d-b484-638fe5353ba4" name="@192 2024-11-06 08:02:24" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010">
<Times creation="2024-11-06T08:02:24.6472140+07:00" queuing="2024-11-06T08:02:24.6472140+07:00" start="2024-11-06T08:02:24.2711630+07:00" finish="2024-11-06T08:02:24.6500910+07:00" />
<TestSettings name="default" id="6acb7458-2291-4d38-a6bb-95ab3bc30c64">
<Deployment runDeploymentRoot="_192_2024-11-06_08_02_24" />
</TestSettings>
<Results>
<UnitTestResult executionId="9a81d049-e9e7-4874-aaae-21e21ccd88fd" testId="c9b94efd-fad8-799d-59fb-84da75310140" testName="PaymentSuccessful_ShouldReturnTrueWhenEnoughFunds" computerName="192" duration="00:00:00.0026430" startTime="2024-11-06T08:02:24.5749060+07:00" endTime="2024-11-06T08:02:24.5775140+07:00" testType="13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b" outcome="Passed" testListId="8c84fa94-04c1-424b-9868-57a2d4851a1d" relativeResultsDirectory="9a81d049-e9e7-4874-aaae-21e21ccd88fd" />
<UnitTestResult executionId="cd4aeb5b-76ca-44ae-b670-b58da908d418" testId="972141ae-87e7-dcb4-0306-227b198b7f87" testName="PaymentUnsuccessful_ShouldReturnFalseWhenInsufficientFunds" computerName="192" duration="00:00:00.0002000" startTime="2024-11-06T08:02:24.5789850+07:00" endTime="2024-11-06T08:02:24.5791850+07:00" testType="13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b" outcome="Passed" testListId="8c84fa94-04c1-424b-9868-57a2d4851a1d" relativeResultsDirectory="cd4aeb5b-76ca-44ae-b670-b58da908d418" />
<UnitTestResult executionId="206c6aed-e789-469b-b2e5-b15f7d247cb1" testId="cee53d66-c073-beae-bfd3-5a8f69631f4e" testName="AddMultipleProductsToCart_ShouldIncreaseCartTotal" computerName="192" duration="00:00:00.0033500" startTime="2024-11-06T08:02:24.5802010+07:00" endTime="2024-11-06T08:02:24.5835510+07:00" testType="13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b" outcome="Passed" testListId="8c84fa94-04c1-424b-9868-57a2d4851a1d" relativeResultsDirectory="206c6aed-e789-469b-b2e5-b15f7d247cb1" />
<UnitTestResult executionId="8a79af1c-28dd-4494-b2bf-4911f97bd1b8" testId="bf07e06e-9dbf-acbe-f7e3-4122445667b1" testName="AddProductToCart_ShouldIncreaseCartTotal" computerName="192" duration="00:00:00.0001010" startTime="2024-11-06T08:02:24.5835580+07:00" endTime="2024-11-06T08:02:24.5836600+07:00" testType="13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b" outcome="Passed" testListId="8c84fa94-04c1-424b-9868-57a2d4851a1d" relativeResultsDirectory="8a79af1c-28dd-4494-b2bf-4911f97bd1b8" />
<UnitTestResult executionId="8e1816d8-c4b8-4bca-a67f-7cc15d97f336" testId="8f51f38c-0140-7212-4610-e1ae152c2782" testName="Deliver_ShouldReturnCorrectDeliveryDetails" computerName="192" duration="00:00:00.0002920" startTime="2024-11-06T08:02:24.5837950+07:00" endTime="2024-11-06T08:02:24.5840870+07:00" testType="13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b" outcome="Passed" testListId="8c84fa94-04c1-424b-9868-57a2d4851a1d" relativeResultsDirectory="8e1816d8-c4b8-4bca-a67f-7cc15d97f336" />
<UnitTestResult executionId="14f974a2-a895-4dcc-ab5e-b22138264258" testId="42e6eb66-64a4-ada1-d638-bbb7ef631c4a" testName="Checkout_ShouldClearCart" computerName="192" duration="00:00:00.0000850" startTime="2024-11-06T08:02:24.5836630+07:00" endTime="2024-11-06T08:02:24.5837480+07:00" testType="13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b" outcome="Passed" testListId="8c84fa94-04c1-424b-9868-57a2d4851a1d" relativeResultsDirectory="14f974a2-a895-4dcc-ab5e-b22138264258" />
</Results>
<TestDefinitions>
<UnitTest name="AddMultipleProductsToCart_ShouldIncreaseCartTotal" storage="/users/thachnguyen/work/autotest/agile-test-sample-projects/nunit/shoppingapp.tests/bin/debug/net8.0/shoppingapp.tests.dll" id="cee53d66-c073-beae-bfd3-5a8f69631f4e">
<Execution id="206c6aed-e789-469b-b2e5-b15f7d247cb1" />
<TestMethod codeBase="/Users/thachnguyen/Work/autotest/agile-test-sample-projects/nunit/ShoppingApp.Tests/bin/Debug/net8.0/ShoppingApp.Tests.dll" adapterTypeName="executor://nunit3testexecutor/" className="ShoppingApp.Tests.CartTests" name="AddMultipleProductsToCart_ShouldIncreaseCartTotal" />
</UnitTest>
<UnitTest name="PaymentUnsuccessful_ShouldReturnFalseWhenInsufficientFunds" storage="/users/thachnguyen/work/autotest/agile-test-sample-projects/nunit/shoppingapp.tests/bin/debug/net8.0/shoppingapp.tests.dll" id="972141ae-87e7-dcb4-0306-227b198b7f87">
<Execution id="cd4aeb5b-76ca-44ae-b670-b58da908d418" />
<TestMethod codeBase="/Users/thachnguyen/Work/autotest/agile-test-sample-projects/nunit/ShoppingApp.Tests/bin/Debug/net8.0/ShoppingApp.Tests.dll" adapterTypeName="executor://nunit3testexecutor/" className="ShoppingApp.Tests.BillingTests" name="PaymentUnsuccessful_ShouldReturnFalseWhenInsufficientFunds" />
</UnitTest>
<UnitTest name="Deliver_ShouldReturnCorrectDeliveryDetails" storage="/users/thachnguyen/work/autotest/agile-test-sample-projects/nunit/shoppingapp.tests/bin/debug/net8.0/shoppingapp.tests.dll" id="8f51f38c-0140-7212-4610-e1ae152c2782">
<Execution id="8e1816d8-c4b8-4bca-a67f-7cc15d97f336" />
<TestMethod codeBase="/Users/thachnguyen/Work/autotest/agile-test-sample-projects/nunit/ShoppingApp.Tests/bin/Debug/net8.0/ShoppingApp.Tests.dll" adapterTypeName="executor://nunit3testexecutor/" className="ShoppingApp.Tests.DeliveryTests" name="Deliver_ShouldReturnCorrectDeliveryDetails" />
</UnitTest>
<UnitTest name="PaymentSuccessful_ShouldReturnTrueWhenEnoughFunds" storage="/users/thachnguyen/work/autotest/agile-test-sample-projects/nunit/shoppingapp.tests/bin/debug/net8.0/shoppingapp.tests.dll" id="c9b94efd-fad8-799d-59fb-84da75310140">
<Execution id="9a81d049-e9e7-4874-aaae-21e21ccd88fd" />
<TestMethod codeBase="/Users/thachnguyen/Work/autotest/agile-test-sample-projects/nunit/ShoppingApp.Tests/bin/Debug/net8.0/ShoppingApp.Tests.dll" adapterTypeName="executor://nunit3testexecutor/" className="ShoppingApp.Tests.BillingTests" name="PaymentSuccessful_ShouldReturnTrueWhenEnoughFunds" />
</UnitTest>
<UnitTest name="AddProductToCart_ShouldIncreaseCartTotal" storage="/users/thachnguyen/work/autotest/agile-test-sample-projects/nunit/shoppingapp.tests/bin/debug/net8.0/shoppingapp.tests.dll" id="bf07e06e-9dbf-acbe-f7e3-4122445667b1">
<Execution id="8a79af1c-28dd-4494-b2bf-4911f97bd1b8" />
<TestMethod codeBase="/Users/thachnguyen/Work/autotest/agile-test-sample-projects/nunit/ShoppingApp.Tests/bin/Debug/net8.0/ShoppingApp.Tests.dll" adapterTypeName="executor://nunit3testexecutor/" className="ShoppingApp.Tests.CartTests" name="AddProductToCart_ShouldIncreaseCartTotal" />
</UnitTest>
<UnitTest name="Checkout_ShouldClearCart" storage="/users/thachnguyen/work/autotest/agile-test-sample-projects/nunit/shoppingapp.tests/bin/debug/net8.0/shoppingapp.tests.dll" id="42e6eb66-64a4-ada1-d638-bbb7ef631c4a">
<Execution id="14f974a2-a895-4dcc-ab5e-b22138264258" />
<TestMethod codeBase="/Users/thachnguyen/Work/autotest/agile-test-sample-projects/nunit/ShoppingApp.Tests/bin/Debug/net8.0/ShoppingApp.Tests.dll" adapterTypeName="executor://nunit3testexecutor/" className="ShoppingApp.Tests.CartTests" name="Checkout_ShouldClearCart" />
</UnitTest>
</TestDefinitions>
<TestEntries>
<TestEntry testId="c9b94efd-fad8-799d-59fb-84da75310140" executionId="9a81d049-e9e7-4874-aaae-21e21ccd88fd" testListId="8c84fa94-04c1-424b-9868-57a2d4851a1d" />
<TestEntry testId="972141ae-87e7-dcb4-0306-227b198b7f87" executionId="cd4aeb5b-76ca-44ae-b670-b58da908d418" testListId="8c84fa94-04c1-424b-9868-57a2d4851a1d" />
<TestEntry testId="cee53d66-c073-beae-bfd3-5a8f69631f4e" executionId="206c6aed-e789-469b-b2e5-b15f7d247cb1" testListId="8c84fa94-04c1-424b-9868-57a2d4851a1d" />
<TestEntry testId="bf07e06e-9dbf-acbe-f7e3-4122445667b1" executionId="8a79af1c-28dd-4494-b2bf-4911f97bd1b8" testListId="8c84fa94-04c1-424b-9868-57a2d4851a1d" />
<TestEntry testId="8f51f38c-0140-7212-4610-e1ae152c2782" executionId="8e1816d8-c4b8-4bca-a67f-7cc15d97f336" testListId="8c84fa94-04c1-424b-9868-57a2d4851a1d" />
<TestEntry testId="42e6eb66-64a4-ada1-d638-bbb7ef631c4a" executionId="14f974a2-a895-4dcc-ab5e-b22138264258" testListId="8c84fa94-04c1-424b-9868-57a2d4851a1d" />
</TestEntries>
<TestLists>
<TestList name="Results Not in a List" id="8c84fa94-04c1-424b-9868-57a2d4851a1d" />
<TestList name="All Loaded Results" id="19431567-8539-422a-85d7-44ee4e166bda" />
</TestLists>
<ResultSummary outcome="Completed">
<Counters total="6" executed="6" passed="6" failed="0" error="0" timeout="0" aborted="0" inconclusive="0" passedButRunAborted="0" notRunnable="0" notExecuted="0" disconnected="0" warning="0" completed="0" inProgress="0" pending="0" />
<Output>
<StdOut>NUnit Adapter 4.5.0.0: Test execution started
Running all tests in /Users/thachnguyen/Work/autotest/agile-test-sample-projects/nunit/ShoppingApp.Tests/bin/Debug/net8.0/ShoppingApp.Tests.dll
NUnit3TestExecutor discovered 6 of 6 NUnit test cases using Current Discovery mode, Non-Explicit run
NUnit Adapter 4.5.0.0: Test execution complete
</StdOut>
</Output>
</ResultSummary>
</TestRun>
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/nunit/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/nunit/multipart' \
-H 'accept: application/json' \
-H 'Authorization: JWT <token>' \
-H 'Content-Type: multipart/form-data' \
-F 'results=@my-report.json;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 detail example
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!