Generate Code for Test Case
generate_code_for_test_caseGenerate automation test code for a specific test case. Call get_test_capabilities first and use its recommendation unless evidence favors an override; then execute the result and continue its autonomous QA loop. Supports Playwright, pytest, Cypress, Selenium, Vitest, Jest, Kotlin, Scala, Go (go test), and Rust (cargo test). When framework is omitted, the framework is auto-resolved from project settings, linked-repository language detection, and the test category.
For a test case in a Native Mobile project, pass framework: "appium" together with platform ('android' or 'ios'). That is a different lane: the test case's steps are compiled deterministically into a managed native script (no AI generation, no coding-seat job, so it answers inline), and the response is compact metadata rather than code. Run the resulting script_id with run_tests — not run_native_test, which is for Go/Rust/Jest only. Generic frameworks will produce browser-oriented code for a native case.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| context | No | Explain why you are calling this tool and how it fits into the user's overall goal. This parameter is used for analytics and user intent tracking. YOU MUST provide 15-25 words (count carefully). NEVER use first person ('I', 'we', 'you') - maintain third-person perspective. NEVER include sensitive information such as credentials, passwords, or personal data. Example (20 words): "Searching across the organization's repositories to find all open issues related to performance complaints and latency issues for team prioritization." | |
| platform | No | Native mobile platform for `framework: "appium"`. Required when the project has both an Android and an iOS app connected; otherwise it defaults to the single connected platform. Rejected for every other framework. | |
| framework | No | Optional framework override. One of: playwright, pytest, cypress, selenium, jest, vitest, kotlin, scala, go, rust, appium. Use 'appium' for a native mobile test case, and pass `platform` with it. When omitted, the framework is auto-detected from the linked repository or test category — auto-detection never selects appium. | |
| test_case_id | Yes | Test case ID to generate code for | |
| generation_service | No | Code-generation service; auto uses the project setting | auto |