CAVISSON API Test Generator
**AI-powered API test case generation for .NET projects **
API Test Generator is a VS Code extension that integrates with GitHub Copilot Chat to automatically generate, review, and publish API test cases from your .NET project's Swagger/OpenAPI documentation. No context-switching, no manual test writing — just describe what you need in natural language.
Features
Conversational Workflow
Interact with the extension through the VS Code Chat panel using @cav-testgen. A guided, multi-step workflow walks you through the entire process — from configuration to saving test cases — all via natural language.
Automatic Swagger Generation
Point the extension at any .csproj file in your workspace and it will build the project, inject Swashbuckle if needed, and generate a complete Swagger/OpenAPI JSON document automatically. The generated file opens in the editor for inspection.
AI-Powered Test Case Generation
The extension calls your configured backend service to generate positive, negative, and edge-case test scenarios for every API endpoint in your project. You control which APIs to target and how many test cases per endpoint.
Smart Filtering & Selection
Review the full list of proposed test cases and refine them using natural language commands:
- "Keep only positive test cases"
- "Show edge cases for POST /users"
- "I want test cases 1, 4, and 6"
- "Remove all negative tests"
One-Click Publishing
Once you're satisfied with your selection, confirm and the extension publishes the chosen test cases directly to your backend server — no copy-pasting or file wrangling required.
Requirements
- VS Code 1.90.0 or later
- GitHub Copilot (or another compatible Language Model provider) installed and signed in
- A .NET project with at least one
.csproj file in the open workspace
- The .NET SDK installed and available on your PATH (for building projects and running the Swagger CLI)
- Access to your organization's test generation backend (Source URL, credentials, and API token)
Getting Started
1. Install the Extension
Install from the VS Code Marketplace or from a .vsix file:
code --install-extension api-test-generator-0.0.1.vsix
Open the Chat panel and type:
@cav-testgen /configure
The assistant will walk you through providing four values:
| Parameter |
Description |
| Source URL |
Base URL of your backend server (e.g. https://myserver.com) |
| User Name |
Your authentication username |
| Project |
Project or sub-project name (e.g. MyApp/Core) |
| Token |
Bearer or API token for authentication |
You can provide all four at once or one at a time — the assistant adapts to your input style.
3. Generate Tests
Once configured, start the test generation workflow:
@cav-testgen /run
The workflow proceeds through these steps:
- Project Selection — Choose which
.csproj to generate tests for.
- Swagger Generation — The extension builds the project and produces the OpenAPI spec.
- Test Generation — Specify an API pattern and test count (e.g. "5 tests for /api/users").
- Review & Filter — Refine the proposed test cases using natural language.
- Save — Publish your selected tests to the backend.
4. Check Status
At any time, type:
@cav-testgen /status
This shows your current configuration and workflow progress.
Commands
All commands are available from the Command Palette (Ctrl+Shift+P / Cmd+Shift+P):
| Command |
Description |
API TestGen: Configure |
Opens the Chat panel for configuration setup |
API TestGen: Run Test Generation |
Opens the Chat panel to start the workflow |
API TestGen: Clear Configuration |
Wipes all saved configuration (with confirmation) |
API TestGen: Reset Workflow |
Resets the workflow to idle without clearing config |
Chat Commands
Use these directly in the Chat panel after mentioning @cav-testgen:
| Command |
Description |
/configure |
Set up Source URL, User Name, Project, and Token |
/run |
Start the multi-step test case generation workflow |
/status |
Show current configuration and workflow state |
How It Works
┌─────────────────────────────────────────────────────┐
│ VS Code Chat Panel │
│ @cav-testgen /run │
└─────────────┬───────────────────────────────────────┘
│
▼
┌─────────────────────────┐ ┌──────────────────────┐
│ Scan Workspace for │ │ Build .NET Project │
│ .csproj Files │────▶│ + Generate Swagger │
└─────────────────────────┘ └──────────┬───────────┘
│
▼
┌──────────────────────┐
│ Upload Swagger JSON │
│ to Backend Server │
└──────────┬───────────┘
│
▼
┌──────────────────────┐
│ AI Generates Test │
│ Cases (SSE Stream) │
└──────────┬───────────┘
│
▼
┌──────────────────────┐
│ Review / Filter / │
│ Select Test Cases │
└──────────┬───────────┘
│
▼
┌──────────────────────┐
│ Publish Selected │
│ Tests to Server │
└──────────────────────┘
The extension uses VS Code's Language Model Tools API to expose a set of tools that the chat participant orchestrates through an agentic loop. Each tool handles one step of the workflow and updates a shared state machine, ensuring steps execute in strict sequence.
Supported Environments
- Windows — Native and WSL-based .NET projects
- Linux — Native .NET SDK installations
- WSL — Automatic path translation between Windows UNC paths and Linux paths
The extension detects your environment and handles path conversions and command execution transparently.
Extension Settings
This extension stores configuration using VS Code's globalState, so your settings persist across sessions. No manual settings.json entries are required — everything is configured through the /configure chat command.
Troubleshooting
"No language model available"
Ensure GitHub Copilot (or another LM provider) is installed and you are signed in.
"No .csproj files found"
Open a folder containing a .NET solution or project before running /run.
Swagger generation fails
Verify the .NET SDK is installed (dotnet --version) and that the project builds successfully (dotnet build).
Backend connection errors
Check your Source URL and Token using /configure. Ensure the server is reachable from your machine.
Workflow gets stuck
Use the API TestGen: Reset Workflow command from the Command Palette, or type /run again to restart.
Debug logs
Open the Output panel in VS Code and select API TestGen Debug from the dropdown to see detailed tool invocations and state transitions.
Known Issues
- The extension currently targets .NET projects only (
.csproj-based builds with Swashbuckle).
- SSL certificate verification is disabled for backend communication to support internal/self-signed certificates.
- The first run on a project will inject Swashbuckle dependencies into the
.csproj and Program.cs if they are not already present.
Release Notes
0.0.1
- Initial release
- Chat participant
@cav-testgen with /configure, /run, and /status commands
- Automatic Swagger/OpenAPI generation from .NET projects
- AI-powered test case generation with SSE streaming progress
- Natural language test case filtering and selection
- One-click test case publishing to backend server
- Full WSL/Windows path translation support
- Debug output channel for troubleshooting
Publisher
Cavisson — cavisson.com