# Rule Testing API

### Request authorization

{% hint style="info" %}
To authenticate your requests, you must use a Bearer token with a valid **Solver API key**.
{% endhint %}

For example:

```
Authorization: Bearer YOUR_SOLVER_API_KEY
```

## Start a Test Run

> Starts a new test run job for the specified test suites or individual tests.  You must provide either an array of \`testSuiteIds\`, an array of \`testIds\`, or both.

```json
{"openapi":"3.0.0","info":{"title":"Rule Testing API","version":"1.0.0"},"servers":[{"url":"https://api.decisionrules.io/testRun"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"http","scheme":"bearer","bearerFormat":"ApiKey"}},"schemas":{"JobState":{"type":"string","enum":["WAITING","RUNNING","COMPLETED","CANCELING","CANCELED","ERROR"]}}},"paths":{"/start":{"post":{"summary":"Start a Test Run","description":"Starts a new test run job for the specified test suites or individual tests.  You must provide either an array of `testSuiteIds`, an array of `testIds`, or both.","operationId":"startTestRun","parameters":[{"name":"x-correlation-id","in":"header","required":false,"description":"A custom correlation ID to track the job execution. If not provided, a GUID will be automatically generated.","schema":{"type":"string"}}],"requestBody":{"description":"Input data specifying which test suites or test cases to run.","required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"testSuiteIds":{"type":"array","items":{"type":"string"},"description":"A list of Test Suite IDs to be executed."},"testIds":{"type":"array","items":{"type":"string"},"description":"A list of individual Test IDs to be executed."}}}}}},"responses":{"200":{"description":"The test run job has been successfully created and queued.","content":{"application/json":{"schema":{"type":"object","properties":{"testRunId":{"type":"string","description":"The ID of the newly created test run job."},"status":{"$ref":"#/components/schemas/JobState","description":"Initial status of the test run job (e.g., WAITING)."}}}}}},"400":{"description":"Business error. Missing parameters or rule resolution failed."},"401":{"description":"Unauthorized. Invalid or missing API key."}}}}}}
```

## Get Test Run Job

> Retrieves test run job details for a specific test run, including its overall execution state and timing context. The job must belong to the requesting space.

```json
{"openapi":"3.0.0","info":{"title":"Rule Testing API","version":"1.0.0"},"servers":[{"url":"https://api.decisionrules.io/testRun"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"http","scheme":"bearer","bearerFormat":"ApiKey"}},"schemas":{"Job":{"type":"object","properties":{"jobId":{"type":"string"},"correlationId":{"type":"string"},"inputData":{"type":"object","additionalProperties":true},"output":{"type":"object","additionalProperties":true,"nullable":true},"status":{"$ref":"#/components/schemas/JobStatus"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"claimedAt":{"type":"string","format":"date-time"},"endedAt":{"type":"string","format":"date-time","nullable":true}}},"JobStatus":{"type":"object","properties":{"state":{"$ref":"#/components/schemas/JobState"},"code":{"type":"string"},"message":{"type":"string","description":"A human-readable message for the status."}}},"JobState":{"type":"string","enum":["WAITING","RUNNING","COMPLETED","CANCELING","CANCELED","ERROR"]}}},"paths":{"/{testRunId}":{"get":{"summary":"Get Test Run Job","description":"Retrieves test run job details for a specific test run, including its overall execution state and timing context. The job must belong to the requesting space.","operationId":"getJobsDetail","parameters":[{"name":"testRunId","in":"path","required":true,"description":"The ID of the test run job to retrieve details for.","schema":{"type":"string"}}],"responses":{"200":{"description":"Job details retrieved successfully.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Job"}}}},"400":{"description":"Business error."},"401":{"description":"Unauthorized. Invalid or missing API key."}}}}}}
```

## Get Test Run Results Detail

> Retrieves detailed information about a specific test run execution, including the evaluation status of individual tests and test suites.

```json
{"openapi":"3.0.0","info":{"title":"Rule Testing API","version":"1.0.0"},"servers":[{"url":"https://api.decisionrules.io/testRun"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"http","scheme":"bearer","bearerFormat":"ApiKey"}},"schemas":{"TestRunRule":{"type":"object","required":["testSuiteRuns"],"properties":{"baseId":{"type":"string"},"baseType":{"$ref":"#/components/schemas/BaseType"},"status":{"$ref":"#/components/schemas/BaseStatus"},"ruleName":{"type":"string"},"ruleAlias":{"type":"string"},"ruleVersion":{"type":"number"},"testSuiteRuns":{"type":"array","items":{"$ref":"#/components/schemas/TestSuiteRun"},"description":"Array of test suites executed under this rule."}}},"BaseType":{"type":"string","enum":["decision-table","complex-rule","composition","decision-tree","workflow","integration-flow","lookup-table","ai-rule"]},"BaseStatus":{"type":"string","enum":["published","pending"]},"TestSuiteRun":{"type":"object","required":["testSuiteId","status","tests","jobId","createdAt"],"properties":{"id":{"type":"string"},"userId":{"type":"string"},"spaceId":{"type":"string"},"ruleAlias":{"type":"string"},"ruleVersion":{"type":"number"},"name":{"type":"string"},"testSuiteId":{"type":"string"},"status":{"$ref":"#/components/schemas/TestSuiteRunStatus"},"tests":{"type":"array","items":{"$ref":"#/components/schemas/TestExecution"}},"jobId":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"claimedAt":{"type":"string","format":"date-time"},"endedAt":{"type":"string","format":"date-time"}}},"TestSuiteRunStatus":{"type":"string","enum":["WAITING","RUNNING","COMPLETED","CANCELED","ERROR"]},"TestExecution":{"type":"object","required":["testId","name","strategy","input","expectedOutput","ignoredOutputs"],"properties":{"id":{"type":"string"},"testId":{"type":"string"},"name":{"type":"string"},"strategy":{"$ref":"#/components/schemas/SolverStrategyEnum"},"input":{"description":"Input payload for the test execution."},"expectedOutput":{"description":"The expected output."},"ignoredOutputs":{"type":"array","items":{"type":"string"},"description":"Array of object paths to ignore (e.g., \"object.property\")"},"sortedInputHash":{"type":"string"},"lastRunAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"resultStatus":{"$ref":"#/components/schemas/TestResultStatus"},"result":{"description":"Actual execution result payload."},"error":{"description":"Error details if the test failed or errored."}}},"SolverStrategyEnum":{"type":"string","enum":["STANDARD","ARRAY","FIRST_MATCH","EVALUATE_ALL"]},"TestResultStatus":{"type":"string","enum":["PASSED","FAILED","ERROR"]}}},"paths":{"/detail/{testRunId}":{"get":{"summary":"Get Test Run Results Detail","description":"Retrieves detailed information about a specific test run execution, including the evaluation status of individual tests and test suites.","operationId":"getTestRunDetail","parameters":[{"name":"testRunId","in":"path","required":true,"description":"The Test Run ID to retrieve results for.","schema":{"type":"string"}}],"responses":{"200":{"description":"Test run details retrieved successfully. Returns an array of evaluated rules, grouped by test suites and their nested test executions.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/TestRunRule"}}}}},"400":{"description":"Business error."},"401":{"description":"Unauthorized. Invalid or missing API key."}}}}}}
```

## The TestRunRule object

```json
{"openapi":"3.0.0","info":{"title":"Rule Testing API","version":"1.0.0"},"components":{"schemas":{"TestRunRule":{"type":"object","required":["testSuiteRuns"],"properties":{"baseId":{"type":"string"},"baseType":{"$ref":"#/components/schemas/BaseType"},"status":{"$ref":"#/components/schemas/BaseStatus"},"ruleName":{"type":"string"},"ruleAlias":{"type":"string"},"ruleVersion":{"type":"number"},"testSuiteRuns":{"type":"array","items":{"$ref":"#/components/schemas/TestSuiteRun"},"description":"Array of test suites executed under this rule."}}},"BaseType":{"type":"string","enum":["decision-table","complex-rule","composition","decision-tree","workflow","integration-flow","lookup-table","ai-rule"]},"BaseStatus":{"type":"string","enum":["published","pending"]},"TestSuiteRun":{"type":"object","required":["testSuiteId","status","tests","jobId","createdAt"],"properties":{"id":{"type":"string"},"userId":{"type":"string"},"spaceId":{"type":"string"},"ruleAlias":{"type":"string"},"ruleVersion":{"type":"number"},"name":{"type":"string"},"testSuiteId":{"type":"string"},"status":{"$ref":"#/components/schemas/TestSuiteRunStatus"},"tests":{"type":"array","items":{"$ref":"#/components/schemas/TestExecution"}},"jobId":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"claimedAt":{"type":"string","format":"date-time"},"endedAt":{"type":"string","format":"date-time"}}},"TestSuiteRunStatus":{"type":"string","enum":["WAITING","RUNNING","COMPLETED","CANCELED","ERROR"]},"TestExecution":{"type":"object","required":["testId","name","strategy","input","expectedOutput","ignoredOutputs"],"properties":{"id":{"type":"string"},"testId":{"type":"string"},"name":{"type":"string"},"strategy":{"$ref":"#/components/schemas/SolverStrategyEnum"},"input":{"description":"Input payload for the test execution."},"expectedOutput":{"description":"The expected output."},"ignoredOutputs":{"type":"array","items":{"type":"string"},"description":"Array of object paths to ignore (e.g., \"object.property\")"},"sortedInputHash":{"type":"string"},"lastRunAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"resultStatus":{"$ref":"#/components/schemas/TestResultStatus"},"result":{"description":"Actual execution result payload."},"error":{"description":"Error details if the test failed or errored."}}},"SolverStrategyEnum":{"type":"string","enum":["STANDARD","ARRAY","FIRST_MATCH","EVALUATE_ALL"]},"TestResultStatus":{"type":"string","enum":["PASSED","FAILED","ERROR"]}}}}
```

## The TestSuiteRun object

```json
{"openapi":"3.0.0","info":{"title":"Rule Testing API","version":"1.0.0"},"components":{"schemas":{"TestSuiteRun":{"type":"object","required":["testSuiteId","status","tests","jobId","createdAt"],"properties":{"id":{"type":"string"},"userId":{"type":"string"},"spaceId":{"type":"string"},"ruleAlias":{"type":"string"},"ruleVersion":{"type":"number"},"name":{"type":"string"},"testSuiteId":{"type":"string"},"status":{"$ref":"#/components/schemas/TestSuiteRunStatus"},"tests":{"type":"array","items":{"$ref":"#/components/schemas/TestExecution"}},"jobId":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"claimedAt":{"type":"string","format":"date-time"},"endedAt":{"type":"string","format":"date-time"}}},"TestSuiteRunStatus":{"type":"string","enum":["WAITING","RUNNING","COMPLETED","CANCELED","ERROR"]},"TestExecution":{"type":"object","required":["testId","name","strategy","input","expectedOutput","ignoredOutputs"],"properties":{"id":{"type":"string"},"testId":{"type":"string"},"name":{"type":"string"},"strategy":{"$ref":"#/components/schemas/SolverStrategyEnum"},"input":{"description":"Input payload for the test execution."},"expectedOutput":{"description":"The expected output."},"ignoredOutputs":{"type":"array","items":{"type":"string"},"description":"Array of object paths to ignore (e.g., \"object.property\")"},"sortedInputHash":{"type":"string"},"lastRunAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"resultStatus":{"$ref":"#/components/schemas/TestResultStatus"},"result":{"description":"Actual execution result payload."},"error":{"description":"Error details if the test failed or errored."}}},"SolverStrategyEnum":{"type":"string","enum":["STANDARD","ARRAY","FIRST_MATCH","EVALUATE_ALL"]},"TestResultStatus":{"type":"string","enum":["PASSED","FAILED","ERROR"]}}}}
```

## The TestExecution object

```json
{"openapi":"3.0.0","info":{"title":"Rule Testing API","version":"1.0.0"},"components":{"schemas":{"TestExecution":{"type":"object","required":["testId","name","strategy","input","expectedOutput","ignoredOutputs"],"properties":{"id":{"type":"string"},"testId":{"type":"string"},"name":{"type":"string"},"strategy":{"$ref":"#/components/schemas/SolverStrategyEnum"},"input":{"description":"Input payload for the test execution."},"expectedOutput":{"description":"The expected output."},"ignoredOutputs":{"type":"array","items":{"type":"string"},"description":"Array of object paths to ignore (e.g., \"object.property\")"},"sortedInputHash":{"type":"string"},"lastRunAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"resultStatus":{"$ref":"#/components/schemas/TestResultStatus"},"result":{"description":"Actual execution result payload."},"error":{"description":"Error details if the test failed or errored."}}},"SolverStrategyEnum":{"type":"string","enum":["STANDARD","ARRAY","FIRST_MATCH","EVALUATE_ALL"]},"TestResultStatus":{"type":"string","enum":["PASSED","FAILED","ERROR"]}}}}
```

## The BaseType object

```json
{"openapi":"3.0.0","info":{"title":"Rule Testing API","version":"1.0.0"},"components":{"schemas":{"BaseType":{"type":"string","enum":["decision-table","complex-rule","composition","decision-tree","workflow","integration-flow","lookup-table","ai-rule"]}}}}
```

## The BaseStatus object

```json
{"openapi":"3.0.0","info":{"title":"Rule Testing API","version":"1.0.0"},"components":{"schemas":{"BaseStatus":{"type":"string","enum":["published","pending"]}}}}
```

## The TestSuiteRunStatus object

```json
{"openapi":"3.0.0","info":{"title":"Rule Testing API","version":"1.0.0"},"components":{"schemas":{"TestSuiteRunStatus":{"type":"string","enum":["WAITING","RUNNING","COMPLETED","CANCELED","ERROR"]}}}}
```

## The TestResultStatus object

```json
{"openapi":"3.0.0","info":{"title":"Rule Testing API","version":"1.0.0"},"components":{"schemas":{"TestResultStatus":{"type":"string","enum":["PASSED","FAILED","ERROR"]}}}}
```

## The SolverStrategyEnum object

```json
{"openapi":"3.0.0","info":{"title":"Rule Testing API","version":"1.0.0"},"components":{"schemas":{"SolverStrategyEnum":{"type":"string","enum":["STANDARD","ARRAY","FIRST_MATCH","EVALUATE_ALL"]}}}}
```

## The JobState object

```json
{"openapi":"3.0.0","info":{"title":"Rule Testing API","version":"1.0.0"},"components":{"schemas":{"JobState":{"type":"string","enum":["WAITING","RUNNING","COMPLETED","CANCELING","CANCELED","ERROR"]}}}}
```

## The JobStatus object

```json
{"openapi":"3.0.0","info":{"title":"Rule Testing API","version":"1.0.0"},"components":{"schemas":{"JobStatus":{"type":"object","properties":{"state":{"$ref":"#/components/schemas/JobState"},"code":{"type":"string"},"message":{"type":"string","description":"A human-readable message for the status."}}},"JobState":{"type":"string","enum":["WAITING","RUNNING","COMPLETED","CANCELING","CANCELED","ERROR"]}}}}
```

## The Job object

```json
{"openapi":"3.0.0","info":{"title":"Rule Testing API","version":"1.0.0"},"components":{"schemas":{"Job":{"type":"object","properties":{"jobId":{"type":"string"},"correlationId":{"type":"string"},"inputData":{"type":"object","additionalProperties":true},"output":{"type":"object","additionalProperties":true,"nullable":true},"status":{"$ref":"#/components/schemas/JobStatus"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"claimedAt":{"type":"string","format":"date-time"},"endedAt":{"type":"string","format":"date-time","nullable":true}}},"JobStatus":{"type":"object","properties":{"state":{"$ref":"#/components/schemas/JobState"},"code":{"type":"string"},"message":{"type":"string","description":"A human-readable message for the status."}}},"JobState":{"type":"string","enum":["WAITING","RUNNING","COMPLETED","CANCELING","CANCELED","ERROR"]}}}}
```


---

# 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.decisionrules.io/doc/api/rule-testing-api.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.
