Cucumber Ltd / cucumber-pro

Send results to apifeatures/test_results/send_results_to_api.feature

Release Dasher II (patch 1) (2018-12-13)

Romain Gérard

Currently viewing

Feature: Send results to REST API

As well as the curl script shown on the project settings, we offer a REST API where you can POST test results.

This lets you send test results in other formats (e.g. JUnit).

We'll try and make sense of them and will either display them, or if we can't work it out we will show you a message when you try to view the test results.

The URL of the endpoint is:

https://app.cucumber.pro/test/r/:projectUid

The payload must be JSON. Here's an example:

{
  "environment": {
    "CIRCLE_BUILD_NUM=12",
    "CIRCLE_BRANCH=master",
    "CIRCLE_BUILD_URL=circle-url"
  },
  "git": {
    "branch": "master",
    "revision": "e14f0f0aa8b05169a2f2368c908582e6e721f83f"
  },
  "payloadContentType": "application/x.cucumber-pro.junit.results+xml",
  "payload": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?><testsuites name=\"Jasmine Tests\" time=\"13.052999999999999\" tests=\"1150\" failures=\"0\" skipped=\"8\"><testsuite name=\"encoding / decoding objects as base64\" timestamp=\"2018-05-16T09:44:37\" tests=\"1\" file=\"/Users/matt/projects/cucumber-pro/lib/base64.spec.js\" failures=\"0\" time=\"0\"><testcase name=\"encoding / decoding objects as base64 decodes what it encodes\" time=\"0\" classname=\"decodes what it encodes\"></testcase></testsuite>",
  "profileName": "Jasmine"
}

Rules

  • Any text-based test result payload will be accepted by a new HTTP endpoint.
  • The HTTP Content-Type header is expected to be application/json.
  • The test result payload media type is passed via the payloadContentType property. Valid media types can be found on the project settings page.

Background:

  • Given Danny has created test-project
  • And Danny has uploaded his public key
  • And Danny has added some documents to test-project
  • And Bob is watching test-project's documentation outline

Scenario: Send JUnit XML results

  • When Someone POSTs JUnit XML results with one test failed, one passed, one pending to the results API endpoint
  • Then Bob should see a test results summary with:
    failed1
    passed1
    pending1