Documentation
AI Test Generation
AI-PoweredAutomatically generate comprehensive test suites using AI that understands your code's logic and edge cases.
Overview
QODRYX's AI analyzes your code to generate meaningful tests that cover:
Unit Tests
Test individual functions and methods in isolation
Integration Tests
Test how components work together
Edge Cases
Test boundary conditions and error scenarios
Regression Tests
Prevent bugs from reappearing after fixes
Supported Test Frameworks
JavaScript/TypeScript
JestVitestMochaPlaywright
Python
pytestunittestnose2
Go
testingtestifyginkgo
Java
JUnitTestNGMockito
Ruby
RSpecMinitest
PHP
PHPUnitPest
How It Works
1
Code Analysis
AI parses your code to understand functions, types, dependencies, and logic flow.
2
Identify Test Cases
Determines what scenarios to test: happy paths, error conditions, edge cases, and boundary values.
3
Generate Tests
Creates well-structured tests with meaningful assertions and descriptive names.
4
Validate & Run
Generated tests are validated and can be run immediately to verify they pass.
Example: Generated Tests
Given this function:
// src/utils/math.ts
export function divide(a: number, b: number): number {
if (b === 0) {
throw new Error("Division by zero");
}
return a / b;
}QODRYX generates:
// src/utils/math.test.ts
import { describe, it, expect } from 'vitest';
import { divide } from './math';
describe('divide', () => {
it('should divide two positive numbers correctly', () => {
expect(divide(10, 2)).toBe(5);
});
it('should handle decimal results', () => {
expect(divide(7, 2)).toBe(3.5);
});
it('should handle negative numbers', () => {
expect(divide(-10, 2)).toBe(-5);
expect(divide(10, -2)).toBe(-5);
});
it('should throw error when dividing by zero', () => {
expect(() => divide(10, 0)).toThrow('Division by zero');
});
it('should return 0 when numerator is 0', () => {
expect(divide(0, 5)).toBe(0);
});
});CLI Usage
# Generate tests for a specific file qodryx test generate src/utils/math.ts # Generate tests for entire directory qodryx test generate src/ # Generate with specific framework qodryx test generate src/ --framework jest # Generate and run immediately qodryx test generate src/ --run # Generate for untested code only qodryx test generate src/ --uncovered-only
Configuration
{
"testing": {
"generation": {
"framework": "vitest",
"style": "describe-it",
"outputDir": "__tests__",
"mockExternals": true,
"includeEdgeCases": true,
"minCoverage": 80
}
}
}Best Practices
- Review generated tests to ensure they match your testing philosophy
- Use generated tests as a starting point, then customize as needed
- Combine with coverage reports to identify gaps
- Regenerate tests when code logic changes significantly