Test generation
Read a source file, generate comprehensive tests with real assertions.
@elyracode/test-gen reads the actual source code, detects the testing framework, and writes tests that exercise the real behavior — not placeholder expect(true).toBe(true) stubs.
Install
elyra install npm:@elyracode/test-gen
Tools
| Tool | Description |
|---|---|
generate_tests |
Read a source file and generate comprehensive tests with real assertions |
find_untested |
Scan the project for source files without corresponding test files |
Commands
| Command | Description |
|---|---|
/test-gen <path> |
Generate tests for a specific file |
/untested |
List source files without tests |
Examples
> Generate tests for app/Http/Controllers/ProductController.php
> Write Pest tests for the User model focusing on validation
> Find files without tests
/test-gen app/Services/PaymentService.php
/untested
How it works
- Auto‑detects framework: Pest for PHP, Vitest for TypeScript/JavaScript
- Reads the actual source for context‑aware assertions
- Suggests correct test file paths (Laravel and TS conventions)
- Analyzes functions, classes, and dependencies
- Extends existing test files rather than duplicating them