Import test result only
POST /ds/test-executions/junit
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 a Test Plan, the tests will automatically be added to it if they are not already included. |
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 JUnit report that is going to be imported. Learn more about JUnit testing framework.
Example
BASH
curl -X 'POST' \
'https://api.agiletest.app/ds/test-executions/junit?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"?>
<testsuite xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://maven.apache.org/surefire/maven-surefire-plugin/xsd/surefire-test-report-3.0.xsd" version="3.0" name="com.shoppingapp.AddressTest" time="0.006" tests="9" errors="0" skipped="0" failures="0">
<properties>
<property name="gopherProxySet" value="false"/>
<property name="awt.toolkit" value="sun.lwawt.macosx.LWCToolkit"/>
<property name="java.specification.version" value="11"/>
<property name="sun.cpu.isalist" value=""/>
<property name="sun.jnu.encoding" value="UTF-8"/>
<property name="java.class.path" value="/Users/thachnguyen/Work/autotest/agile-test-sample-projects/junit/target/test-classes:/Users/thachnguyen/Work/autotest/agile-test-sample-projects/junit/target/classes:/Users/thachnguyen/.m2/repository/org/junit/jupiter/junit-jupiter-api/5.7.0/junit-jupiter-api-5.7.0.jar:/Users/thachnguyen/.m2/repository/org/apiguardian/apiguardian-api/1.1.0/apiguardian-api-1.1.0.jar:/Users/thachnguyen/.m2/repository/org/opentest4j/opentest4j/1.2.0/opentest4j-1.2.0.jar:/Users/thachnguyen/.m2/repository/org/junit/platform/junit-platform-commons/1.7.0/junit-platform-commons-1.7.0.jar:/Users/thachnguyen/.m2/repository/org/junit/jupiter/junit-jupiter-engine/5.7.0/junit-jupiter-engine-5.7.0.jar:/Users/thachnguyen/.m2/repository/org/junit/platform/junit-platform-engine/1.7.0/junit-platform-engine-1.7.0.jar:/Users/thachnguyen/.m2/repository/org/mockito/mockito-core/3.12.4/mockito-core-3.12.4.jar:/Users/thachnguyen/.m2/repository/net/bytebuddy/byte-buddy/1.11.13/byte-buddy-1.11.13.jar:/Users/thachnguyen/.m2/repository/net/bytebuddy/byte-buddy-agent/1.11.13/byte-buddy-agent-1.11.13.jar:/Users/thachnguyen/.m2/repository/org/objenesis/objenesis/3.2/objenesis-3.2.jar:/Users/thachnguyen/.m2/repository/org/mockito/mockito-junit-jupiter/3.12.4/mockito-junit-jupiter-3.12.4.jar:/Users/thachnguyen/.m2/repository/org/slf4j/slf4j-simple/1.7.30/slf4j-simple-1.7.30.jar:/Users/thachnguyen/.m2/repository/org/slf4j/slf4j-api/1.7.30/slf4j-api-1.7.30.jar:"/>
<property name="java.vm.vendor" value="Homebrew"/>
<property name="sun.arch.data.model" value="64"/>
<property name="java.vendor.url" value="https://github.com/Homebrew/homebrew-core/issues"/>
<property name="user.timezone" value=""/>
<property name="java.vm.specification.version" value="11"/>
<property name="os.name" value="Mac OS X"/>
<property name="sun.java.launcher" value="SUN_STANDARD"/>
<property name="user.country" value="VN"/>
<property name="sun.boot.library.path" value="/opt/homebrew/Cellar/openjdk@11/11.0.21/libexec/openjdk.jdk/Contents/Home/lib"/>
<property name="sun.java.command" value="/Users/thachnguyen/Work/autotest/agile-test-sample-projects/junit/target/surefire/surefirebooter3444332120704230486.jar /Users/thachnguyen/Work/autotest/agile-test-sample-projects/junit/target/surefire 2024-11-05T16-27-38_971-jvmRun1 surefire14941232156557041274tmp surefire_0651957426851720248tmp"/>
<property name="http.nonProxyHosts" value="local|*.local|169.254/16|*.169.254/16"/>
<property name="jdk.debug" value="release"/>
<property name="surefire.test.class.path" value="/Users/thachnguyen/Work/autotest/agile-test-sample-projects/junit/target/test-classes:/Users/thachnguyen/Work/autotest/agile-test-sample-projects/junit/target/classes:/Users/thachnguyen/.m2/repository/org/junit/jupiter/junit-jupiter-api/5.7.0/junit-jupiter-api-5.7.0.jar:/Users/thachnguyen/.m2/repository/org/apiguardian/apiguardian-api/1.1.0/apiguardian-api-1.1.0.jar:/Users/thachnguyen/.m2/repository/org/opentest4j/opentest4j/1.2.0/opentest4j-1.2.0.jar:/Users/thachnguyen/.m2/repository/org/junit/platform/junit-platform-commons/1.7.0/junit-platform-commons-1.7.0.jar:/Users/thachnguyen/.m2/repository/org/junit/jupiter/junit-jupiter-engine/5.7.0/junit-jupiter-engine-5.7.0.jar:/Users/thachnguyen/.m2/repository/org/junit/platform/junit-platform-engine/1.7.0/junit-platform-engine-1.7.0.jar:/Users/thachnguyen/.m2/repository/org/mockito/mockito-core/3.12.4/mockito-core-3.12.4.jar:/Users/thachnguyen/.m2/repository/net/bytebuddy/byte-buddy/1.11.13/byte-buddy-1.11.13.jar:/Users/thachnguyen/.m2/repository/net/bytebuddy/byte-buddy-agent/1.11.13/byte-buddy-agent-1.11.13.jar:/Users/thachnguyen/.m2/repository/org/objenesis/objenesis/3.2/objenesis-3.2.jar:/Users/thachnguyen/.m2/repository/org/mockito/mockito-junit-jupiter/3.12.4/mockito-junit-jupiter-3.12.4.jar:/Users/thachnguyen/.m2/repository/org/slf4j/slf4j-simple/1.7.30/slf4j-simple-1.7.30.jar:/Users/thachnguyen/.m2/repository/org/slf4j/slf4j-api/1.7.30/slf4j-api-1.7.30.jar:"/>
<property name="sun.cpu.endian" value="little"/>
<property name="user.home" value="/Users/thachnguyen"/>
<property name="user.language" value="en"/>
<property name="java.specification.vendor" value="Oracle Corporation"/>
<property name="java.version.date" value="2023-10-17"/>
<property name="java.home" value="/opt/homebrew/Cellar/openjdk@11/11.0.21/libexec/openjdk.jdk/Contents/Home"/>
<property name="file.separator" value="/"/>
<property name="basedir" value="/Users/thachnguyen/Work/autotest/agile-test-sample-projects/junit"/>
<property name="java.vm.compressedOopsMode" value="Zero based"/>
<property name="line.separator" value=" "/>
<property name="java.specification.name" value="Java Platform API Specification"/>
<property name="java.vm.specification.vendor" value="Oracle Corporation"/>
<property name="java.awt.graphicsenv" value="sun.awt.CGraphicsEnvironment"/>
<property name="surefire.real.class.path" value="/Users/thachnguyen/Work/autotest/agile-test-sample-projects/junit/target/surefire/surefirebooter3444332120704230486.jar"/>
<property name="sun.management.compiler" value="HotSpot 64-Bit Tiered Compilers"/>
<property name="ftp.nonProxyHosts" value="local|*.local|169.254/16|*.169.254/16"/>
<property name="java.runtime.version" value="11.0.21+0"/>
<property name="user.name" value="thachnguyen"/>
<property name="path.separator" value=":"/>
<property name="os.version" value="12.5"/>
<property name="java.runtime.name" value="OpenJDK Runtime Environment"/>
<property name="file.encoding" value="UTF-8"/>
<property name="java.vm.name" value="OpenJDK 64-Bit Server VM"/>
<property name="java.vendor.version" value="Homebrew"/>
<property name="localRepository" value="/Users/thachnguyen/.m2/repository"/>
<property name="java.vendor.url.bug" value="https://github.com/Homebrew/homebrew-core/issues"/>
<property name="java.io.tmpdir" value="/var/folders/f0/hxzh9_fx1zb29pdn334l6nr40000gn/T/"/>
<property name="java.version" value="11.0.21"/>
<property name="user.dir" value="/Users/thachnguyen/Work/autotest/agile-test-sample-projects/junit"/>
<property name="os.arch" value="aarch64"/>
<property name="java.vm.specification.name" value="Java Virtual Machine Specification"/>
<property name="java.awt.printerjob" value="sun.lwawt.macosx.CPrinterJob"/>
<property name="sun.os.patch.level" value="unknown"/>
<property name="java.library.path" value="/Users/thachnguyen/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:."/>
<property name="java.vm.info" value="mixed mode"/>
<property name="java.vendor" value="Homebrew"/>
<property name="java.vm.version" value="11.0.21+0"/>
<property name="java.specification.maintenance.version" value="2"/>
<property name="sun.io.unicode.encoding" value="UnicodeBig"/>
<property name="java.class.version" value="55.0"/>
<property name="socksNonProxyHosts" value="local|*.local|169.254/16|*.169.254/16"/>
</properties>
<testcase name="testEqualsSameAddress" classname="com.shoppingapp.AddressTest" time="0.001"/>
<testcase name="testHashCodeConsistency" classname="com.shoppingapp.AddressTest" time="0"/>
<testcase name="testEqualsDifferentAddress" classname="com.shoppingapp.AddressTest" time="0.004"/>
<testcase name="testGetFullAddress" classname="com.shoppingapp.AddressTest" time="0"/>
<testcase name="testSetStreet" classname="com.shoppingapp.AddressTest" time="0.001"/>
<testcase name="testSetCity" classname="com.shoppingapp.AddressTest" time="0"/>
<testcase name="testToStringFormat" classname="com.shoppingapp.AddressTest" time="0"/>
<testcase name="testSetZipCode" classname="com.shoppingapp.AddressTest" time="0"/>
<testcase name="testSetState" classname="com.shoppingapp.AddressTest" time="0"/>
</testsuite>
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/junit/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/behave/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 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!