# Test Runs

This endpoint is used to create, and read the results of, test runs.\
\
API URL - <https://api.moropo.com/testsruns>&#x20;

### Available actions

1. Create Test Run
2. Check Test Run Status

### Example - Triggering a Test Run

Note this request uses `POST` to inform the API that a test run is being created. This example is for a basic usage of the endpoint. The docs linked above provide a comprehensive specification of all possible overrides.

<pre class="language-bash"><code class="lang-bash">curl -X 'POST' \
  'https://api.moropo.com/testRuns' \
  -H 'accept: */*' \
  -H 'x-app-api-key: MOROPO_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
	"ciCdId": "SCHEDULED_TEST_RUN_ID"
<strong>}'
</strong></code></pre>

Where;

* `MOROPO_API_KEY` is the API key for the target app, found in your [Moropo settings](https://app.moropo.com/settings?index=integrations).
* `SCHEDULED_TEST_RUN_ID` is the UUID of the scheduled test run you wish to create.&#x20;

#### Expected Response

```json
{
  "statusCode": 200,
  "body": "{
  \"message\":\"Success\",
  \"testRunInfo\":{
    \"id\":TEST_RUN_ID,
    \"buildId\":\"BUILD_ID\",
    \"devices\":[\"DEVICES\"],
    \"tests\":[\"TESTS\"],
    \"expoReleaseChannel\":\"EXPO_RELEASE_CHANNEL\",
    \"url\":\"TEST_RUN_URL"
    }
  }"
}
```

### Example - Reading Test Run Status

This request uses `GET` to inform the API test run status is being requested

```bash
curl -X 'GET' \
  'https://api.test.moropo.com/testRuns/TEST_RUN_ID' \
  -H 'accept: */*' \
  -H 'x-app-api-key: MOROPO_API_KEY'
```

Where;

* `MOROPO_API_KEY` is the API key for the target app, found in your [Moropo settings](https://app.moropo.com/settings?index=integrations).
* `TEST_RUN_ID` is the ID of the test you want to request the results for.

#### Expected Response

```json
{
  "statusCode": 200,
  "body": "{
    \"complete\":true,
    \"passed\":true,
    \"message\":\"Tests passed\"
  }"
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.moropo.com/ci-integration/moropo-api/test-runs.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
