Skip to main content

Test Cases

Create, generate, edit, organize, publish, and inspect individual tests.

MethodPathWhat it does
POST/test-cases/Bulk-create test cases (generation optional via schedule flag)
POST/test-case/Create a single test case and immediately queue generation
GET/test-case/{test_case_id}Get full test case detail including generated steps
DELETE/test-case/{test_case_id}Delete a test case and all its runs
GET/test-case/state/{test_case_id}Get just the generation state (cheap to poll)
PATCH/test-case/{test_case_id}/editPartial update (only supplied fields are changed; schedule query flag controls regeneration)
PUT/test-case/{test_case_id}/regenerateRe-run generation
POST/test-case/{test_case_id}/record-journeyTrigger journey recording
PUT/test-case/{test_case_id}/append-descriptionAppend text to the description and regenerate
PUT/test-case/{test_case_id}/user-feedbackSubmit step-level feedback to steer generation
DELETE/test-case/cancel/{test_case_id}Cancel queued generation
PATCH/test-case/{test_case_id}/steps/{step_index}Mark a step optional or mandatory
DELETE/test-cases/{test_case_id}/steps/{test_step_index}Delete a step
GET/test-case/{test_case_id}/parametersList a test case's parameters
PATCH/test-cases/{test_case_id}/collectionsSet which collections the test belongs to
POST/test-cases/{test_case_id}/copyDeep-copy a test within its suite
PUT/test-cases/{test_case_id}/renameRename a test case
PUT/test-cases/{test_case_id}/update-test-pathMove a test to a different folder path
PUT/test-cases/{test_suite_id}/update-test-pathsBulk-update folder paths
PUT/test-cases/{test_case_id}/set-test-suite/{new_test_suite_id}Move a test to another suite
PUT/test-case/{test_case_id}/publishPublish a test case at a public URL
GET/test-case/{test_case_id}/slugsList a test's published slugs
GET/public/test-case/{slug_or_id}Fetch a published test case (no auth required)

Creating a test case

Minimum required fields are name, description, and test_suite_id.

curl -X POST "https://cj-backend.foreai.co/test-cases/" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"test_suite_id": "ddfa83cd-b43d-4b68-8931-42684931f58d",
"test_cases": [{
"name": "Login — happy path",
"description": "Step 1. Navigate to the login page. Expectation: login form is visible.\nStep 2. Enter username and password and click Sign in. Expectation: user is redirected to the dashboard.",
"website": "https://example.com",
"test_suite_id": "ddfa83cd-b43d-4b68-8931-42684931f58d",
"parameters": { "username": "jdoe", "password": "password123" }
}]
}'
["3f2504e0-4f89-11d3-9a0c-0305e82c3301"]

All TestCaseRequest fields

FieldRequiredDescription
nameYesShort identifier for the test
descriptionYesPlain-language steps and expectations used to generate the test
test_suite_idYesSuite to add the test to
websiteNoBase URL the test runs against
pathNoFolder path within the suite (e.g. checkout/guest/)
parametersNoKey/value pairs available as variables within the test
shared_parameter_idsNoUUIDs of suite-level shared parameters to attach
asset_parameter_idsNoUUIDs of asset parameters to attach
browser_state_idNoPre-authenticated browser session to start from
collection_idsNoCollections to add this test to
enable_proxiesNoRoute through proxy (default true)
proxy_idNoSpecific proxy UUID
geolocationNo{ "latitude": 47.38, "longitude": 8.54 }
accept_languageNoe.g. "de-CH,de;q=0.9"
browser_type_overrideNochromium, firefox, webkit, msedge
viewport_width / viewport_heightNoBrowser viewport dimensions
user_agentNoCustom user-agent string
mobile_app_asset_idNoUUID of an uploaded .apk / .ipa (mobile tests only)
test_module_id_for_setupNoTest module to run as setup before this test
is_flakyNoMark as known flaky (default false)
note

Mobile testing — to test a mobile app instead of a website, omit website and set mobile_app_asset_id to the UUID of an uploaded .apk or .ipa asset. Upload the binary first via POST /assets/.


Polling generation state

After creating a test, poll until generation completes:

curl "https://cj-backend.foreai.co/test-case/state/<test_case_id>" \
-H "Authorization: Bearer <token>"
{ "state": "completed" }

States follow this path: pendingwaiting_for_executorrunningcompleted. Stop polling when state is completed or a terminal error state (failed, resources_exceeded, error, executor_not_available). See Status enumerations for the full list.


TestCase response fields

Returned by GET /test-case/{test_case_id}:

FieldTypeDescription
_idUUIDTest case ID
namestring
descriptionstring
stateTestStateGeneration lifecycle state
websitestringURL under test
test_suite_idUUID
org_idUUID
pathstringFolder path within the suite
parametersobjectKey/value test parameters
test_generation_stepsarrayGenerated steps with code, screenshots, and status
latest_run_statusTestRunStatusStatus of the most recent run
latest_run_timedatetime
is_flakybooleanMarked as known flaky
is_publicbooleanPublished via a public URL
created_at / last_modified_atdatetime

Editing a test case

PATCH /test-case/{test_case_id}/edit — all fields optional; omitting a field leaves it unchanged. Pass ?schedule=false to update metadata without triggering regeneration.

FieldTypeDescription
namestring
descriptionstring
pathstringMove to a different folder
parametersobjectReplace parameter values
shared_parameter_idsUUID[]
asset_parameter_idsUUID[]
browser_state_idUUID
collection_idsUUID[]
proxy_idUUID
enable_proxiesboolean
browser_type_overrideBrowserTypechromium, firefox, webkit, msedge
viewport_width / viewport_heightinteger
geolocationobject{ "latitude": 47.38, "longitude": 8.54 }
accept_languagestringe.g. "de-CH,de;q=0.9"