One-Click AI Agent for Java Unit Testing
Features β’ Installation β’ Quick Start β’ Documentation β’ Contributing
Generate, run, and fix JUnit tests automatically β right inside IntelliJ IDEA
Writing comprehensive unit tests is time-consuming. JAIPilot eliminates the tedious work by generating intelligent, context-aware JUnit tests in seconds. Focus on building features while JAIPilot ensures your code is thoroughly tested.
- Writing unit tests manually is repetitive and time-consuming
- Achieving high test coverage requires significant effort
- Fixing failing tests often involves multiple iterations
- Keeping tests up-to-date with code changes is tedious
JAIPilot is an AI-powered IntelliJ IDEA plugin that:
- Understands your code context, dependencies, and edge cases
- Generates complete tests with meaningful assertions in seconds
- Automatically fixes failing tests until they pass
- Integrates seamlessly with your existing JUnit workflow
- Context-aware analysis β understands method logic, parameters, dependencies, and edge cases
- Intelligent test creation β generates meaningful test cases with proper assertions
- Multiple test frameworks β supports all JUnit version
- Right-click any class to instantly generate comprehensive test suites
- Custom test locations β specify your preferred test root directory (e.g.,
src/test/java)
- Automatic test execution β runs generated tests immediately
- Smart failure detection β identifies and analyzes test failures
- Self-healing tests β automatically fixes failing tests until they pass
- Iterative improvement β refines tests based on compilation and runtime errors
- Dynamic model selection β chooses the best AI model per class for speed and accuracy
- Resource efficient β minimal impact on IDE performance
- Works out-of-the-box with existing Java projects
- JUnit integration β fully compatible with your test infrastructure
- IDE native experience β feels like a built-in IntelliJ feature
- No configuration required β start generating tests immediately
- 40 request attempts free on signup (~4 classes worth of test generation)
- No credit card required β start generating tests immediately
- Pay-as-you-go billing β top up credits after free tier
- Open IntelliJ IDEA
- Go to Settings/Preferences β Plugins β Marketplace
- Search for "JAIPilot" or "java-auto-unit-tests"
- Click Install and restart your IDE
- Install JAIPilot from the JetBrains Marketplace and restart IntelliJ
- Sign up for a JAIPilot account at jaipilot.com (no credit card required)
- You'll receive 40 request attempts (~4 classes) worth of free credits
- Check your email for the license key (also available in your JAIPilot account page)
- In IntelliJ, go to Settings/Preferences β Tools β JAIPilot Plugin
- Paste your license key to activate test generation
// Your Java class
public class Calculator {
public int add(int a, int b) {
return a + b;
}
public int divide(int a, int b) {
if (b == 0) throw new IllegalArgumentException("Cannot divide by zero");
return a / b;
}
}Steps:
- Right-click on the
Calculatorclass - Select "Generate Tests with JAIPilot"
- Choose your test root directory (e.g.,
src/test/java) - Wait a few seconds while JAIPilot generates comprehensive tests
- Review the generated test file with full coverage
Generated Test (Example):
public class CalculatorTest {
private Calculator calculator;
@BeforeEach
void setUp() {
calculator = new Calculator();
}
@Test
void testAdd_PositiveNumbers() {
assertEquals(5, calculator.add(2, 3));
}
@Test
void testAdd_NegativeNumbers() {
assertEquals(-5, calculator.add(-2, -3));
}
@Test
void testDivide_ValidInput() {
assertEquals(2, calculator.divide(6, 3));
}
@Test
void testDivide_ThrowsExceptionWhenDivideByZero() {
assertThrows(IllegalArgumentException.class, () -> calculator.divide(10, 0));
}
}If any tests fail:
- JAIPilot automatically detects failures
- Analyzes error messages and stack traces
- Regenerates and fixes tests until they pass
- No manual intervention required
Configure JAIPilot settings in Settings/Preferences β Tools β JAIPilot:
- License Key β enter your license key from email or account page to activate the plugin
- Test Root Directory β specify where tests should be generated (default:
src/test/java)
Important: You must activate your license key before generating tests. After signing up at jaipilot.com, you'll receive a license key via email. Paste this key in the plugin settings to start using JAIPilot.
- IntelliJ IDEA 2023.1 or later (Community or Ultimate)
Issue: Tests not generating Solution: Ensure your license key is activated in plugin settings and your project has JUnit dependencies
Issue: License key not working Solution: Copy the full license key from your email or account page. Ensure there are no extra spaces.
Issue: "No credits remaining" error Solution: Top up your credits at jaipilot.com/account with pay-as-you-go billing
Issue: Tests failing after generation Solution: Wait for JAIPilot's automatic refinement process to complete
For more issues, check our FAQ or open an issue.
We welcome contributions from the community! Whether you're fixing bugs, adding features, or improving documentation, your help is appreciated.
- π Report bugs
- π‘ Suggest features
- π Improve documentation
- π§ Submit pull requests
- β Star the project to show your support
See our Contributing Guide for detailed instructions.
This project is licensed under the Mozilla Public License 2.0 - see the LICENSE file for details.
- Built with the IntelliJ Platform Plugin SDK
- Powered by advanced AI models for intelligent test generation
- Inspired by the developer community's need for better testing tools