Test Case Generator

Write test cases from a function's description or signature: the happy path, edge cases, boundaries and errors.

Pay by wallet (x402) AI-generated test-case-generate

Example

Example answer
{
  "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

FieldTypeRequiredWhat it is
languagestringNo—
include_edge_casesbooleanNo—
function_descriptionstringYes—

Output fields

How reliably each field appears in a successful answer.

FieldTypeAppears
test_casesarrayAlways (present in every successful answer)
total_casesintegerAlways (present in every successful answer)
coverage_notesstringAlways (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
  }'

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