QUnit — AI Test Generator for VS Code
Generate, run, and auto-fix unit tests for Moleculer.js and TypeScript projects — directly from your editor, powered by Google Gemini.
QUnit reads the function you're working on, proposes a structured test plan, writes idiomatic Mocha / Chai / Sinon specs into the matching test file, runs them for you, and automatically repairs any failures — using your own Gemini API key.
Overview
|
|
| Supported Frameworks |
Moleculer.js, Express.js, generic TypeScript / JavaScript |
| AI Provider |
Google Gemini (user-supplied API key) |
Key Features
| Feature |
Description |
| AI test planning |
Proposes scenarios classified by priority — Critical, High, Medium, Low — so you choose what gets generated. |
| One-click generation |
A Generate Unit Test action appears inline above every function, method, or service action. |
| Mocha and Jest support |
Auto-detects your project's test runner. Generates Mocha + Chai + Sinon tests by default, or Jest tests for Jest projects. |
| Smart mocking |
Automatically handles service calls and database dependencies so your tests run in isolation. |
| Automatic self-repair |
Runs the generated tests, reads failures, refines the code, and re-runs — up to 5 attempts (configurable). |
| Non-destructive updates |
New cases are added to your existing test file without overwriting tests you've written by hand. |
| Interactive test panel |
Dedicated tabs for Input Context, Test Plan, Generated Test, and Execution Result — with one-click re-run. |
| Sidebar navigation |
Activity-bar view with Functions, Statistics, History, and API-key management. |
| Status bar indicator |
A live 🧪 Tests: X Passed, Y Failed summary in the VS Code status bar — click it to open the Statistics dashboard. |
| Statistics dashboard |
A full webview with pass/fail totals and per-function breakdown across the workspace. |
Installation
- Open the Extensions view in VS Code (
Ctrl+Shift+X).
- Search for QUnit.
- Click Install on QUnit — Test Generator by Q4US.

After installation, open the QUnit view from the activity bar (flask icon).

Quick Start
Once installed, here's how to generate your first test with QUnit — from API key setup to a green test run.
1. Provide your Gemini API key
On first use, QUnit prompts for your Gemini API key.

A free key is available at Google AI Studio.
2. Open a source file
QUnit scans the open file and shows a Generate Unit Test action directly above each function, method, or service action.

3. Review the proposed test plan
Before any code is written, Gemini returns a structured plan. Each scenario has a priority tag ([High], [Medium], [Low]) and a short description, and you can include or exclude individual cases.

4. Smart merge with existing tests
If a test file already exists, QUnit asks before changing anything.

- Apply Changes — add the new cases to your existing test file.
- Show Diff — preview the change first.
- Discard / Cancel — keep the file as it is.
5. Automatic validation and self-repair
After writing the tests, QUnit runs them. If anything fails, it reviews the error, fixes the code, and re-runs — automatically.

6. Live status in the editor
The inline action updates to show the latest result and quick follow-up options.

- ✓ PASSED / ✗ FAILED — current status for that function.
- ↻ Re-Generate — re-plan and rewrite the tests.
- View Test Plan — open the detailed panel.
7. Test plan and execution panel
Open the dedicated panel to add more scenarios, review the generated tests, and watch test runs live.


The Execution Result tab shows each test case pass/fail and the full output from the test run.
8. Clean, readable tests
QUnit produces well-structured Mocha specs that are easy to read and maintain.

9. Track progress across your workspace
As you generate tests for more functions, the QUnit sidebar collects everything in one place — detected functions with live ✓ / ✗ status, a statistics summary, a history of past generations, and API-key management.

Click Open Statistics Dashboard (or the status-bar 🧪 Tests indicator) to open a full workspace-wide view with a Test Execution Overview, pass/fail donut chart, and a detailed per-function results table.

Configuration
QUnit works out of the box with sensible defaults. If you want to customize its behavior, you can do it in either of two places:
- Settings UI — open File → Preferences → Settings (
Ctrl+,) and search for ai-test-generator. Each option appears with its description, defaults, and dropdowns.
settings.json — open the Command Palette (Ctrl+Shift+P) → Preferences: Open User Settings (JSON) and add the keys directly. Handy if you want to share the same configuration across a team via workspace settings.

| Setting |
Default |
What it does |
When you'd change it |
ai-test-generator.autoValidateTests |
true |
After writing your tests, QUnit runs them automatically and tries to fix any failures. |
Turn off if you prefer QUnit to just write the tests and leave running and fixing to you. |
ai-test-generator.maxFixAttempts |
5 |
How many times QUnit will retry fixing a failing test before giving up. |
Lower this (1–2) if you don't want to wait long on failures; keep at 5 for the best chance of a clean pass. |
ai-test-generator.framework |
auto |
Which style of tests to generate: auto, moleculer, express, or generic. auto picks the best fit based on your project. |
Force a specific style if auto-detect gets it wrong — for example, a mixed project where you want Moleculer tests. |
ai-test-generator.testCommand |
npm test |
The command QUnit uses to run your tests. |
Change to yarn test, pnpm test, npx jest, or your project's custom script. |
Example settings.json:
{
"ai-test-generator.autoValidateTests": true,
"ai-test-generator.maxFixAttempts": 3,
"ai-test-generator.framework": "moleculer",
"ai-test-generator.testCommand": "npm test"
}
Requirements
- VS Code 1.85 or newer.
- Node.js and
npm available on your PATH.
- A Google Gemini API key (the free tier is enough to get started).
Commands
| Command |
Palette title |
ai-test-generator.generateTests |
Generate Unit Tests |
ai-test-generator.generateTestsForActiveFile |
QUnit: Generate Unit Tests for Active File |
ai-test-generator.setApiKey |
QUnit: Set Gemini API Key |
ai-test-generator.logout |
Clear Gemini API Key |
ai-test-generator.runTest |
Run Test |
ai-test-generator.showStatistics |
Show Statistics |
Support
Connect with Q4US
License
MIT — see LICENSE. Copyright © 2026 Q4US.