Test Suggestions

Description

jiayaoqijia Updated

File contents

Description

Suggest unit tests from file list and function definitions. Analyzes code to recommend test cases and provides test templates for better coverage.

Inputs

{
  "files": ["list of source files"],
  "functions": ["function names to test"]
}

Outputs

{
  "ok": true,
  "data": {
    "suggestions": [],
    "coverage_estimate": "75%"
  }
}

Usage

Demo Mode

python scripts/main.py --demo

Get Test Suggestions

echo '{"files": ["main.py"], "functions": ["process_data"]}' | python3 scripts/main.py

Examples

Example 1: Test Suggestions

$ echo '{"files": ["utils.py"], "functions": ["calculate_total"]}' | python3 scripts/main.py
{
  "ok": true,
  "data": {
    "suggestions": ["Test with positive numbers", "Test with negative numbers", "Test edge cases"],
    "coverage_estimate": "85%"
  }
}

Error Handling

When an error occurs, the skill returns:

{
  "ok": false,
  "error": "Error description",
  "details": {
    "files": "File not found"
  }
}

jiayaoqijia/cryptoskill/tree/main/skills/ai-crypto/xspoonai-official-test-suggestions commit 8462a00175

Frequently asked questions

npx skillmds@latest add jiayaoqijia/test-suggestions