Test Case Generator
Write test cases from a function's description or signature: the happy path, edge cases, boundaries and errors.
test-case-generate Example
{
"test_cases": [
{
"name": "Empty function call",
"input": {},
"category": "happy_path",
"description": "Tests calling test() with no arguments",
"expected_output": null
},
{
"name": "Null input",
"input": null,
"category": "edge_case",
"description": "Tests behavior when null is passed",
"expected_output": null
},
{
"name": "Undefined input",
"input": "undefined",
"category": "edge_case",
"description": "Tests behavior when undefined is passed",
"expected_output": null
},
{
"name": "Empty string input",
"input": "",
"category": "boundary",
"description": "Tests behavior with empty string",
"expected_output": null
},
{
"name": "Empty array input",
"input": [],
"category": "boundary",
"description": "Tests behavior with empty array",
"expected_output": null
},
{
"name": "Empty object input",
"input": {},
"category": "boundary",
"description": "Tests behavior with empty object",
"expected_output": null
},
{
"name": "Invalid parameter type",
"input": "invalid_type",
"category": "error_case",
"description": "Tests behavior with unexpected parameter type",
"expected_output": null
}
],
"total_cases": 7,
"coverage_notes": "Limited coverage due to insufficient function signature information. The function name 'test' is generic with no parameters defined. Test cases cover basic null/undefined handling, boundary conditions with empty values, and type validation. Actual coverage would improve with concrete parameter types and return type specification. Consider providing the full function implementation for comprehensive testing.",
"language_detected": "JavaScript/TypeScript"
} Inputs
| Field | Type | Required | What it is |
|---|---|---|---|
language | string | No | — |
include_edge_cases | boolean | No | — |
function_description | string | Yes | — |
Output fields
How reliably each field appears in a successful answer.
| Field | Type | Appears |
|---|---|---|
test_cases | array | Always (present in every successful answer) |
total_cases | integer | Always (present in every successful answer) |
coverage_notes | string | Always (present in every successful answer) |
How to call it
The same tool through each route. MCP clients reach it through Strale’s server at https://api.strale.io/mcp; the call below is what the agent sends.
# Needs an API key. max_price_cents caps what this call may cost.
curl -X POST https://api.strale.io/v1/do \
-H "Authorization: Bearer $STRALE_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"capability_slug": "test-case-generate",
"inputs": {
"function_description": "function add(a: number, b: number): number — returns the sum of two numbers"
},
"max_price_cents": 15
}' {
"tool": "strale_execute",
"arguments": {
"slug": "test-case-generate",
"inputs": {
"function_description": "function add(a: number, b: number): number — returns the sum of two numbers"
},
"max_price_cents": 15
}
} import { Strale } from "straleio";
const strale = new Strale({ apiKey: process.env.STRALE_API_KEY! });
const result = await strale.do({
capability_slug: "test-case-generate",
inputs: {
"function_description": "function add(a: number, b: number): number — returns the sum of two numbers"
},
max_price_cents: 15,
}); import os
from straleio import Strale, DoRequest
strale = Strale(api_key=os.environ["STRALE_API_KEY"])
result = strale.do(DoRequest(
capability_slug="test-case-generate",
inputs={
"function_description": "function add(a: number, b: number): number — returns the sum of two numbers",
},
max_price_cents=15,
)) # No account. The first request answers 402 with the price in USDC;
# an x402 client pays it from your wallet and repeats the request.
curl -i 'https://api.strale.io/x402/v2/test-case-generate?function_description=function+add%28a%3A+number%2C+b%3A+number%29%3A+number+%E2%80%94+returns+the+sum+of+two+numbers' Limitations
Business-specific edge cases need manual tests
AI-generated test cases cover common paths — edge cases specific to your business logic may require manual test authoring
What to do instead: Use generated tests as a starting coverage baseline and add domain-specific edge cases manually
Output size cap per call
Structured output is limited to about 2000 output tokens per call; requests exceeding this limit are refused rather than returned truncated. Requests with large results can exceed this limit, and repeating the same request does not help.
What to do instead: Request fewer test cases per call, or set include_edge_cases to false
Bundled checks that include it
- API Quality Check €0.50
Related tools
- Agent Trace Analysis €0.20
- API Docs Generator €0.20
- API Mock Responses €0.05
- Changelog Generator €0.03
- Code Converter €0.05
- Commit Message Generator €0.05