---
title: "Test"
method: POST
path: "/api/v1/functions/{function_id}/test"
tags: ["Function"]
---

# Test

`POST /api/v1/functions/{function_id}/test`

Test runs a function's test suite in a sandboxed environment and returns the results.

## Path parameters

- `function_id` string, required — The function ID to test.

## Request body

- C1ApiFunctionsV1FunctionsServiceTestRequestInput — FunctionsServiceTestRequest runs tests for a function at a specific commit.
  - `commitId` string — The commit ID to test. If empty, the published commit is used.

## Response `200`

FunctionsServiceTestResponse contains test execution results.

- C1ApiFunctionsV1FunctionsServiceTestResponse — FunctionsServiceTestResponse contains test execution results.
  - `result` C1ApiFunctionsV1FunctionTestResult — FunctionTestResult contains the result of a single test case execution.
    - `assertions` C1ApiFunctionsV1FunctionTestResultFunctionTestResultAssertion[], nullable — The assertions evaluated during the test.
      - `actual` string — The actual value.
      - `at` string — Source location of the assertion.
      - `description` string — Description of the assertion.
      - `expected` string — The expected value.
      - `operator` string — The comparison operator (e.g., "==", "!=").
      - `pass` boolean — Whether the assertion passed.
    - `error` string — Error message if the test errored (distinct from assertion failure).
    - `logs` C1ApiFunctionsV1FunctionTestResultFunctionTestResultLog[], nullable — The log entries captured during the test.
      - `level` string — The log level (e.g., "info", "error").
      - `log` string — The log message content.
      - `source` string — The log source (e.g., "stdout", "stderr").
    - `name` string — The test name.
    - `status` 'FUNCTION_TEST_RESULT_STATUS_UNSPECIFIED' | 'FUNCTION_TEST_RESULT_STATUS_OK' | 'FUNCTION_TEST_RESULT_STATUS_FAIL' | 'FUNCTION_TEST_RESULT_STATUS_SKIPPED' — The test result status.
  - `results` C1ApiFunctionsV1FunctionTestResult[], nullable — All test results.
    - `assertions` C1ApiFunctionsV1FunctionTestResultFunctionTestResultAssertion[], nullable — The assertions evaluated during the test.
      - `actual` string — The actual value.
      - `at` string — Source location of the assertion.
      - `description` string — Description of the assertion.
      - `expected` string — The expected value.
      - `operator` string — The comparison operator (e.g., "==", "!=").
      - `pass` boolean — Whether the assertion passed.
    - `error` string — Error message if the test errored (distinct from assertion failure).
    - `logs` C1ApiFunctionsV1FunctionTestResultFunctionTestResultLog[], nullable — The log entries captured during the test.
      - `level` string — The log level (e.g., "info", "error").
      - `log` string — The log message content.
      - `source` string — The log source (e.g., "stdout", "stderr").
    - `name` string — The test name.
    - `status` 'FUNCTION_TEST_RESULT_STATUS_UNSPECIFIED' | 'FUNCTION_TEST_RESULT_STATUS_OK' | 'FUNCTION_TEST_RESULT_STATUS_FAIL' | 'FUNCTION_TEST_RESULT_STATUS_SKIPPED' — The test result status.

---

[API](https://skmtc.net/conductorone/apis/c1-api.md) · [All operations](https://skmtc.net/conductorone/apis/c1-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/conductorone/c1-api/versions/d391405a35d3/schema)
