Cavisson API Test Generator
AI-powered API test case generation for .NET and Java projects, driven entirely from VS Code Chat.
Cavisson API Test Generator is a VS Code extension that turns a .NET or Java project's Swagger/OpenAPI contract — enriched with Code Intelligence about the underlying source — into AI-generated API test cases, without leaving the editor. Point it at a project, a running application, or an existing Swagger/OpenAPI file, and the extension handles the rest: acquiring the API contract, generating candidate test cases, letting you review and filter them in natural language, and saving the ones you keep.
Overview
The extension works through a single VS Code Chat participant, @cav-testgen. It's intended for developers on .NET or Java teams who want to go from "here's my API" to "here are reviewed test cases" without manually writing test scaffolding.
At a high level:
- You configure the extension once with your backend connection details.
- You start a run and choose how the extension should obtain your API's Swagger/OpenAPI document — build a local project, reach an already-running instance, or import an existing file.
- The extension optionally analyzes your project with Code Intelligence to give the AI a deeper understanding of the implementation, not just the contract.
- Test cases are generated and streamed back in real time.
- You review, filter, and select the test cases you want using plain language.
- Confirmed test cases are saved.
Key Features
- Conversational workflow — the entire process (
/configure, /run, /status, /reset) runs through natural-language chat with @cav-testgen, with a guided, step-by-step flow.
- .NET and Java support — works with .NET (
.csproj) and Java/Spring Boot (Maven or Gradle) projects alike; the extension detects which one you're using automatically.
- Three ways to obtain a Swagger/OpenAPI document:
- Build and analyze a project in the current workspace.
- Fetch the document over HTTP from an already-running application.
- Import an existing Swagger/OpenAPI JSON file from disk.
- Automatic Swagger/OpenAPI generation — for local projects, the extension prepares the project and generates the document for you.
- Code Intelligence — an additional, best-effort analysis of your source code (via Roslyn for .NET, Eclipse JDT for Java) that gives the AI a richer understanding of your API than the Swagger/OpenAPI contract alone. It never slows down or blocks the rest of the workflow.
- AI-powered test case generation — get positive, negative, and edge-case test scenarios for the endpoints you target, with control over which APIs to cover and how many test cases per endpoint.
- Natural-language review and filtering — refine the proposed test cases with plain requests such as "keep only positive tests" or "show me test cases 1, 4, and 6."
- Custom tagging on save — optionally attach custom tags to the test cases you publish.
- Live streaming progress — watch test generation progress in real time as it happens.
- Automatic model fallback — if your selected AI model has an issue, the extension automatically retries with another available model.
- Environment variable capture — mention a
KEY=VALUE pair mid-conversation (e.g. a connection string) and the extension picks it up and uses it automatically.
- Cross-platform support — works on Windows, Linux, and WSL.
- Session-isolated results — every run keeps its own results, so nothing from one run leaks into another.
- Secure configuration storage — your API token is stored securely using your operating system's credential store.
User Workflow
Starting /run first checks that you're configured, then asks how the extension should obtain your Swagger/OpenAPI document:
1. 🚀 Launch Application Locally
2. 📡 Use Running Instance of Application
3. 📄 I already have an OpenAPI specs file
1. Launch Application Locally
- The extension scans your workspace for projects (.NET or Java) and asks which one to use.
- It builds the project and generates a Swagger/OpenAPI document automatically.
- Code Intelligence analysis runs automatically against the selected project.
2. Use Running Instance
- You provide the URL of an already-running application (localhost, LAN, or a remote server).
- The extension fetches and validates the Swagger/OpenAPI document over HTTP.
- The extension tries to automatically match the document to a local project for Code Intelligence; if it isn't confident, it asks you to pick one, or you can skip this step.
3. I already have an OpenAPI specs file
- You provide the path to an existing Swagger/OpenAPI JSON file on disk.
- The extension validates and imports it.
- As with Running Instance mode, you're offered an optional Code Intelligence pass, or you can skip it.
All three modes converge on the same next steps: the Swagger/OpenAPI document is shown to you, you specify what to generate, test cases stream back, you review and filter them, and you confirm what to save.
Code Intelligence
Code Intelligence is the extension's best-effort analysis of your .NET or Java source code, used to give AI-based test generation a richer understanding of your API than the Swagger/OpenAPI contract alone provides. It uses Roslyn for .NET projects and Eclipse JDT for Java projects, chosen automatically based on the project you selected.
Where the Swagger/OpenAPI document describes the contract of an API — its routes, parameters, and response shapes — Code Intelligence looks at the implementation behind that contract. It never blocks or delays the rest of the workflow: if it's unavailable or you skip it, test generation proceeds normally from the Swagger/OpenAPI document alone.
Swagger / OpenAPI Document
+
Code Intelligence
↓
Better understanding of API contract + implementation behavior
↓
AI-generated API test cases
- Always optional. In Running Instance and Existing File modes, you can decline it entirely; in Local mode it runs automatically against the project you already selected.
- Never blocking. If it fails, times out, or isn't available on your platform, the rest of the workflow continues as normal.
- Scoped to your run. Results are tied to the current run only.
AI Test Generation
Once a Swagger/OpenAPI document (and optional Code Intelligence output) is available:
- Request — you specify an API URL pattern (e.g.
/users, /orders/*, or all) and how many test cases to generate per endpoint.
- Stream — generation progress streams back to the chat in real time until it's done.
- Review & filter — you refine the proposed list using natural language (e.g. "keep only negative tests for POST /orders").
- Save — once you confirm a selection, you're optionally asked about custom tags, and the selected test cases are saved.
Chat Commands
| Command |
Purpose |
/configure |
Set up (or update) your connection details. |
/run |
Start the multi-step test case generation workflow. |
/status |
Show your current configuration and workflow progress. |
/reset |
Wipe all saved configuration and workflow state and start fresh. |
Configuration
/configure collects the following, all required before /run can start:
| Field |
Description |
| Source URL |
Base URL of your backend service. |
| User Name |
Your authentication username. |
| Project |
Project or sub-project name (e.g. MyApp or MyApp/SubModule). |
| Token |
Your API token or credential. |
| Swagger Base Path |
Where generated Swagger/OpenAPI files should be uploaded (deployment-specific). |
You can supply all values in one message or provide them one at a time — the extension keeps track of what's already been given and only asks for what's missing. Nothing is saved until you explicitly confirm.
Your API token is stored securely using your operating system's credential store, separate from your other settings. Configuration is fully managed through chat — no manual settings files required.
A few optional VS Code settings are also available under API Test Generator in Settings, for choosing a specific AI model or adjusting how eagerly the extension prepares projects — the defaults work well for most users.
Example Usage
User:
@cav-testgen /run
Extension:
How should I access the application to generate its Swagger/OpenAPI document?
1. 🚀 Launch Application Locally
2. 📡 Use Running Instance of Application
3. 📄 I already have an OpenAPI specs file
User:
1
Extension:
Select the project to use: [list of discovered projects]
User:
2
Extension:
Swagger/OpenAPI document generated. Code Intelligence analysis complete.
What API pattern and how many test cases per endpoint would you like?
User:
5 tests for /api/users
Extension:
Generating API test cases... [progress streams in]
Here are the proposed test cases for /api/users: ...
User:
Keep only the positive test cases
Extension:
Here's the filtered list: ...
User:
Save these
Extension:
Would you like to add any custom tags before publishing?
Troubleshooting
"No language model available"
Ensure GitHub Copilot (or another compatible AI provider) is installed and you are signed in.
"The extension is not fully configured"
Run /configure and provide all required fields (Source URL, User Name, Project, Token, Swagger Base Path).
"No .csproj files found"
Open a folder containing a .NET solution/project, or a Java project (pom.xml or build.gradle), before running /run in Local mode.
Swagger/OpenAPI generation fails
For .NET, verify the .NET SDK is installed (dotnet --version) and that the target project builds successfully (dotnet build). For Java, verify Maven/Gradle (or the project's wrapper) can build the project successfully.
Code Intelligence doesn't run for a Java project
Make sure a Java 17+ runtime is installed and available as java on PATH. This step is best-effort, so the rest of the workflow still proceeds even if it's skipped.
Connection errors
Check your Source URL and Token via /configure, and confirm your backend server is reachable.
Workflow seems stuck
Type /reset and start again with /run.
Known Limitations
- The extension targets .NET and Java (Spring Boot) projects.
- The first Swagger/OpenAPI generation on a project may add required dependencies if they aren't already present.
Publisher
Cavisson — cavisson.com