Skip to main content
Skip table of contents

Behave JSON result

Import test result only

POST /ds/test-executions/behave

Parameters and request body

Param

Type

Required

Description

projectKey

string

(tick)

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 JSON file which is Behave report that is going to be imported. Learn more about Behave testing framework here.

Example

BASH
curl -X 'POST' \
  'https://api.agiletest.app/ds/test-executions/behave?projectKey=ATP' \
  -H 'accept: application/json' \
  -H 'Authorization: JWT <token>' \
  -H 'Content-Type: application/json' \
  --data-binary '@my-report.json'

In that, <token> is the result from previous step Get Authenticated.

Make sure your test report file includes the relevant issue keys in the form of tags; otherwise, the import will fail. For further details, please refer to our GitHub repository.

Keep in mind that if the referenced test cases are not of the Gherkin type, test step details will be excluded from the parsed results.

Test result example
JSON
[
{
  "elements": [
    {
      "keyword": "Scenario",
      "location": "features/shopping.feature:5",
      "name": "Add item to cart",
      "status": "passed",
      "steps": [
        {
          "keyword": "Given",
          "location": "features/shopping.feature:6",
          "match": {
            "arguments": [
              {
                "name": "product_name",
                "value": "Laptop"
              },
              {
                "name": "price",
                "value": "1000"
              }
            ],
            "location": "features/steps/shopping_steps.py:5"
          },
          "name": "I have a product named \"Laptop\" priced at 1000",
          "result": {
            "duration": 7.605552673339844e-05,
            "status": "passed"
          },
          "step_type": "given"
        },
        {
          "keyword": "When",
          "location": "features/shopping.feature:7",
          "match": {
            "arguments": [],
            "location": "features/steps/shopping_steps.py:10"
          },
          "name": "I add the product to my cart",
          "result": {
            "duration": 2.09808349609375e-05,
            "status": "passed"
          },
          "step_type": "when"
        },
        {
          "keyword": "Then",
          "location": "features/shopping.feature:8",
          "match": {
            "arguments": [
              {
                "name": "total",
                "value": "1000"
              }
            ],
            "location": "features/steps/shopping_steps.py:14"
          },
          "name": "my cart total should be 1000",
          "result": {
            "duration": 1.8835067749023438e-05,
            "status": "passed"
          },
          "step_type": "then"
        }
      ],
      "tags": [
        "ATP-1858"
      ],
      "type": "scenario"
    },
    {
      "keyword": "Scenario",
      "location": "features/shopping.feature:11",
      "name": "Checkout cart",
      "status": "passed",
      "steps": [
        {
          "keyword": "Given",
          "location": "features/shopping.feature:12",
          "match": {
            "arguments": [
              {
                "name": "total",
                "value": "1000"
              }
            ],
            "location": "features/steps/shopping_steps.py:18"
          },
          "name": "I have a cart with a total of 1000",
          "result": {
            "duration": 2.6941299438476562e-05,
            "status": "passed"
          },
          "step_type": "given"
        },
        {
          "keyword": "When",
          "location": "features/shopping.feature:13",
          "match": {
            "arguments": [],
            "location": "features/steps/shopping_steps.py:25"
          },
          "name": "I checkout",
          "result": {
            "duration": 1.811981201171875e-05,
            "status": "passed"
          },
          "step_type": "when"
        },
        {
          "keyword": "Then",
          "location": "features/shopping.feature:14",
          "match": {
            "arguments": [],
            "location": "features/steps/shopping_steps.py:29"
          },
          "name": "my cart should be empty",
          "result": {
            "duration": 1.6927719116210938e-05,
            "status": "passed"
          },
          "step_type": "then"
        }
      ],
      "tags": [
        "ATP-1857"
      ],
      "type": "scenario"
    },
    {
      "keyword": "Scenario",
      "location": "features/shopping.feature:17",
      "name": "Add multiple items to cart",
      "status": "passed",
      "steps": [
        {
          "keyword": "Given",
          "location": "features/shopping.feature:18",
          "match": {
            "arguments": [
              {
                "name": "product1",
                "value": "Laptop"
              },
              {
                "name": "price1",
                "value": "1000"
              },
              {
                "name": "product2",
                "value": "Phone"
              },
              {
                "name": "price2",
                "value": "500"
              }
            ],
            "location": "features/steps/shopping_steps.py:33"
          },
          "name": "I have products named \"Laptop\" priced at 1000 and \"Phone\" priced at 500",
          "result": {
            "duration": 3.695487976074219e-05,
            "status": "passed"
          },
          "step_type": "given"
        },
        {
          "keyword": "When",
          "location": "features/shopping.feature:19",
          "match": {
            "arguments": [],
            "location": "features/steps/shopping_steps.py:39"
          },
          "name": "I add both products to my cart",
          "result": {
            "duration": 1.7881393432617188e-05,
            "status": "passed"
          },
          "step_type": "when"
        },
        {
          "keyword": "Then",
          "location": "features/shopping.feature:20",
          "match": {
            "arguments": [
              {
                "name": "total",
                "value": "1500"
              }
            ],
            "location": "features/steps/shopping_steps.py:14"
          },
          "name": "my cart total should be 1500",
          "result": {
            "duration": 1.71661376953125e-05,
            "status": "passed"
          },
          "step_type": "then"
        }
      ],
      "tags": [
        "ATP-1856"
      ],
      "type": "scenario"
    },
    {
      "keyword": "Scenario",
      "location": "features/shopping.feature:23",
      "name": "Apply discount to cart",
      "status": "passed",
      "steps": [
        {
          "keyword": "Given",
          "location": "features/shopping.feature:24",
          "match": {
            "arguments": [
              {
                "name": "total",
                "value": "1000"
              }
            ],
            "location": "features/steps/shopping_steps.py:18"
          },
          "name": "I have a cart with a total of 1000",
          "result": {
            "duration": 2.5033950805664062e-05,
            "status": "passed"
          },
          "step_type": "given"
        },
        {
          "keyword": "When",
          "location": "features/shopping.feature:25",
          "match": {
            "arguments": [
              {
                "name": "amount",
                "value": "100"
              }
            ],
            "location": "features/steps/shopping_steps.py:44"
          },
          "name": "I apply a discount of 100",
          "result": {
            "duration": 1.7881393432617188e-05,
            "status": "passed"
          },
          "step_type": "when"
        },
        {
          "keyword": "Then",
          "location": "features/shopping.feature:26",
          "match": {
            "arguments": [
              {
                "name": "total",
                "value": "900"
              }
            ],
            "location": "features/steps/shopping_steps.py:14"
          },
          "name": "my cart total should be 900",
          "result": {
            "duration": 1.7881393432617188e-05,
            "status": "passed"
          },
          "step_type": "then"
        }
      ],
      "tags": [
        "ATP-1855"
      ],
      "type": "scenario"
    },
    {
      "keyword": "Scenario",
      "location": "features/shopping.feature:29",
      "name": "Attempt to checkout with insufficient funds",
      "status": "passed",
      "steps": [
        {
          "keyword": "Given",
          "location": "features/shopping.feature:30",
          "match": {
            "arguments": [
              {
                "name": "total",
                "value": "1000"
              }
            ],
            "location": "features/steps/shopping_steps.py:18"
          },
          "name": "I have a cart with a total of 1000",
          "result": {
            "duration": 2.47955322265625e-05,
            "status": "passed"
          },
          "step_type": "given"
        },
        {
          "keyword": "And",
          "location": "features/shopping.feature:31",
          "match": {
            "arguments": [
              {
                "name": "amount",
                "value": "500"
              }
            ],
            "location": "features/steps/shopping_steps.py:48"
          },
          "name": "I have only 500 in my account",
          "result": {
            "duration": 3.2901763916015625e-05,
            "status": "passed"
          },
          "step_type": "given"
        },
        {
          "keyword": "When",
          "location": "features/shopping.feature:32",
          "match": {
            "arguments": [],
            "location": "features/steps/shopping_steps.py:53"
          },
          "name": "I checkout multiple products",
          "result": {
            "duration": 2.5033950805664062e-05,
            "status": "passed"
          },
          "step_type": "when"
        },
        {
          "keyword": "Then",
          "location": "features/shopping.feature:33",
          "match": {
            "arguments": [
              {
                "name": "message",
                "value": "Insufficient funds"
              }
            ],
            "location": "features/steps/shopping_steps.py:60"
          },
          "name": "I should see an error message \"Insufficient funds\"",
          "result": {
            "duration": 1.8835067749023438e-05,
            "status": "passed"
          },
          "step_type": "then"
        }
      ],
      "tags": [
        "ATP-1854"
      ],
      "type": "scenario"
    }
  ],
  "keyword": "Feature",
  "location": "features/shopping.feature:2",
  "name": "Shopping Cart",
  "status": "passed",
  "tags": [
    "ATP-1856"
  ]
}
]
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/behave/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

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

  2. agileTestFields object:

    • milestoneId: The identifier of the milestone that this test execution should be associated with.

    • testPlanKeys: An array of issue keys of Test plan that this test execution is related to.

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.

For the report, it will be similar to Import test result only.

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.json;type=application/json' \
  -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!

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.