Sitelet https://github.com/skrcode/java-auto-unit-tests
Skip to content

Repository files navigation

JAIPilot

One-Click AI Agent for Java Unit Testing

Version Downloads Build License

FeaturesInstallationQuick StartDocumentationContributing

Generate, run, and fix JUnit tests automatically — right inside IntelliJ IDEA


Why JAIPilot?

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.

The Problem

  • 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

The Solution

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

✨ Features

🤖 AI-Powered Test Generation

  • 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

⚡ One-Click Automation

  • Right-click any class to instantly generate comprehensive test suites
  • Custom test locations — specify your preferred test root directory (e.g., src/test/java)

🔄 Autonomous Test Refinement

  • 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

🎯 Optimized Performance

  • Dynamic model selection — chooses the best AI model per class for speed and accuracy
  • Resource efficient — minimal impact on IDE performance

🔗 Seamless Integration

  • 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

🆓 Free Credits to Get Started

  • 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

📦 Installation

Install from JetBrains Marketplace (Recommended)

  1. Open IntelliJ IDEA
  2. Go to Settings/PreferencesPluginsMarketplace
  3. Search for "JAIPilot" or "java-auto-unit-tests"
  4. Click Install and restart your IDE

🚀 Quick Start

1. Install and Activate JAIPilot

  1. Install JAIPilot from the JetBrains Marketplace and restart IntelliJ
  2. Sign up for a JAIPilot account at jaipilot.com (no credit card required)
  3. You'll receive 40 request attempts (~4 classes) worth of free credits
  4. Check your email for the license key (also available in your JAIPilot account page)
  5. In IntelliJ, go to Settings/PreferencesToolsJAIPilot Plugin
  6. Paste your license key to activate test generation

2. Generate Your First Test

// 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:

  1. Right-click on the Calculator class
  2. Select "Generate Tests with JAIPilot"
  3. Choose your test root directory (e.g., src/test/java)
  4. Wait a few seconds while JAIPilot generates comprehensive tests
  5. 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));
    }
}

3. Let JAIPilot Fix Failing Tests

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

📚 Documentation

Configuration

Configure JAIPilot settings in Settings/PreferencesToolsJAIPilot:

  • 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.

Requirements

  • IntelliJ IDEA 2023.1 or later (Community or Ultimate)

Troubleshooting

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.


🤝 Contributing

We welcome contributions from the community! Whether you're fixing bugs, adding features, or improving documentation, your help is appreciated.

Ways to Contribute

  • 🐛 Report bugs
  • 💡 Suggest features
  • 📖 Improve documentation
  • 🔧 Submit pull requests
  • ⭐ Star the project to show your support

See our Contributing Guide for detailed instructions.


📊 Project Stats

GitHub stars GitHub forks GitHub watchers GitHub issues GitHub pull requests GitHub contributors

📝 License

This project is licensed under the Mozilla Public License 2.0 - see the LICENSE file for details.


🙏 Acknowledgments

  • 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

🔗 Links


Built with ❤️ by developers, for developers

If JAIPilot helps you ship faster, please consider giving it a ⭐ on GitHub!

Star on GitHub

About

IntelliJ experiment for AI-assisted Java unit-test generation and verification.

Topics

Resources

Contributing

Security policy

Stars

3 stars

Watchers

1 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages