AI-powered automatic test case generation for Java and Kotlin projects with Web UI and CLI
Project description
Universal Tester - AI-Powered Test Generation
Automatically generate high-quality JUnit tests for Java and Kotlin projects using AI - with complete code privacy using local LLMs.
Universal Tester leverages Large Language Models (LLMs) to understand your code and create comprehensive test suites with proper mocking, assertions, and edge case coverage. It comes with both a Command-Line Interface (CLI) and a Web UI for maximum flexibility.
๐ Unique Security Feature
๐ Unique Security Feature
Your Code Never Leaves Your Machine!
Unlike other AI testing tools that send your code to cloud services, Universal Tester supports Ollama - a runtime platform that lets you run powerful open-source LLMs (Llama, Mistral, CodeLlama, etc.) entirely on your own computer.
Why This Matters:
- โ Complete Privacy: Your proprietary source code stays on your machine
- โ 100% Offline: No internet required for test generation
- โ Enterprise-Safe: Complies with strict corporate security policies
- โ Zero Trust Architecture: No cloud providers can access your code
- โ FREE: No API costs - unlimited test generation at no charge
- โ Compliance-Ready: Meets requirements for regulated industries (healthcare, finance, government)
You Have Options: While Ollama provides maximum security through local LLM execution, you can also use Azure OpenAI or Google Gemini if your team prefers cloud-based models.
- โ 100% Offline Operation with Ollama
- โ No Cloud Uploads - Your code stays on your machine
- โ Enterprise-Safe - Perfect for proprietary and sensitive codebases
- โ FREE - No API costs with local models
- โ Your Choice - Also supports Azure OpenAI and Google Gemini if preferred
๐ Features
- โ ๐ Local LLM Support (Ollama): Run any open-source LLM locally - your code never leaves your machine
- โ Multi-LLM Support: Azure OpenAI, Google Gemini, or Ollama (run LLMs locally/offline)
- โ Smart Import Detection: Automatic dependency analysis and import management
- โ Two Interfaces: CLI for automation, Web UI for interactive use
- โ Java & Kotlin: Full support for both languages
- โ Multiple Frameworks: JUnit 5, Mockito, MockK, Kotest
- โ Spring Boot Ready: Special handling for Spring annotations and dependency injection
- โ Incremental Testing: Generate tests for specific files or entire projects
- โ Context-Aware: Understands your code structure and dependencies
- โ No Vendor Lock-in: Switch between LLM providers anytime
๐ฆ Installation
Prerequisites
- Python 3.8+ (Tested and certified on Python 3.13.5)
- โ ๏ธ Important: Requires Python 3.8 or higher to avoid compatibility issues
- โ Certified on: Python 3.13.5
- ๐ Compatible with: Python 3.8, 3.9, 3.10, 3.11, 3.12, 3.13+ (based on dependencies)
- pip (Python package manager)
- LLM API access (Azure OpenAI, Google Gemini, or Ollama)
Recommended: Use Virtual Environment
We strongly recommend using a virtual environment to avoid dependency conflicts:
# Create virtual environment
python -m venv universal-tester-env
# Activate on Windows
universal-tester-env\Scripts\activate
# Activate on Linux/Mac
source universal-tester-env/bin/activate
# Install universal-tester
pip install universal-tester
Install from PyPI
pip install universal-tester
That's it! Both CLI and Web UI are included.
Verify Installation
universal-tester --version
๐ฏ Quick Start
1. Configure Your LLM Provider
Copy .env.example to .env and configure:
# Ollama (FREE - Recommended for local development)
LLM_PROVIDER=ollama
OLLAMA_HOST=http://localhost:11434
OLLAMA_MODEL=llama3.1:8b
# OR Azure OpenAI
LLM_PROVIDER=azure_openai
AZURE_OPENAI_API_KEY=your-api-key
AZURE_OPENAI_ENDPOINT=https://your-endpoint.openai.azure.com/
AZURE_OPENAI_DEPLOYMENT=gpt-4
# OR Google Gemini
LLM_PROVIDER=google
GOOGLE_API_KEY=your-google-api-key
GOOGLE_MODEL=gemini-2.0-flash:generateContent
2. Generate Tests (CLI)
# Generate tests from a ZIP file
universal-tester --input /path/to/your-project.zip
# With custom output directory
universal-tester -i project.zip -o ./generated-tests
3. Or Use the Web UI
# Launch the web interface
universal-tester-ui
Then upload your ZIP file and click "Generate Tests"!
๐ก Usage Examples
CLI Examples
Basic test generation:
universal-tester --input myproject.zip
Kotlin with MockK:
universal-tester --input kotlin-app.zip --language kotlin --framework mockk
Use specific LLM provider:
universal-tester --input project.zip --llm-provider google
Verbose mode:
universal-tester --input project.zip --verbose
Web UI
- Start the UI:
universal-tester-ui - Open
http://localhost:8000in your browser - Upload your Java/Kotlin project (ZIP format)
- Click "Generate Tests"
- Download the generated test files
๐จ What Tests Look Like
Input: UserService.java
@Service
public class UserService {
@Autowired
private UserRepository userRepository;
public User findById(Long id) {
return userRepository.findById(id)
.orElseThrow(() -> new UserNotFoundException(id));
}
}
Generated: UserServiceTest.java
@ExtendWith(MockitoExtension.class)
class UserServiceTest {
@Mock
private UserRepository userRepository;
@InjectMocks
private UserService userService;
@Test
void findById_WhenUserExists_ReturnsUser() {
// Arrange
Long userId = 1L;
User expectedUser = new User(userId, "John Doe");
when(userRepository.findById(userId)).thenReturn(Optional.of(expectedUser));
// Act
User result = userService.findById(userId);
// Assert
assertNotNull(result);
assertEquals(expectedUser.getId(), result.getId());
assertEquals(expectedUser.getName(), result.getName());
verify(userRepository).findById(userId);
}
@Test
void findById_WhenUserNotFound_ThrowsException() {
// Arrange
Long userId = 999L;
when(userRepository.findById(userId)).thenReturn(Optional.empty());
// Act & Assert
assertThrows(UserNotFoundException.class, () -> userService.findById(userId));
verify(userRepository).findById(userId);
}
}
๐ง Configuration
Environment Variables
| Variable | Description | Required |
|---|---|---|
LLM_PROVIDER |
LLM provider: azure, google, or ollama |
โ Yes |
AZURE_OPENAI_API_KEY |
Azure OpenAI API key | If using Azure |
AZURE_OPENAI_ENDPOINT |
Azure endpoint URL | If using Azure |
AZURE_OPENAI_DEPLOYMENT_NAME |
Azure deployment name | If using Azure |
GOOGLE_API_KEY |
Google Gemini API key | If using Google |
OLLAMA_BASE_URL |
Ollama server URL | If using Ollama |
OLLAMA_MODEL |
Ollama model name | If using Ollama |
CLI Options
universal-tester [OPTIONS]
Options:
-i, --input PATH Input ZIP file path (required)
-o, --output PATH Output directory (default: ./generated_tests)
--llm-provider TEXT LLM provider override (azure/google/ollama)
--language TEXT Source language (java/kotlin)
--framework TEXT Test framework (junit/mockito/mockk/kotest)
-v, --verbose Enable verbose logging
--version Show version
--help Show help message
๐ Documentation
- Complete User Guide - Detailed documentation
- LLM Provider Setup - Configure Azure, Google, or Ollama
- Troubleshooting - Common issues and solutions
- FAQ - Frequently asked questions
๐ฏ Use Cases
For Developers
- Quickly create test scaffolding for new code
- Improve test coverage on legacy code
- Learn testing best practices from generated examples
- Speed up TDD workflow
For Teams
- Standardize test patterns across the codebase
- Onboard new team members with consistent test examples
- Reduce time spent writing boilerplate tests
- Focus on complex business logic testing
For CI/CD
- Integrate into build pipelines
- Generate tests automatically on code commits
- Maintain test coverage metrics
- Automate test creation for new features
๐ Why Universal Tester?
| Feature | Universal Tester | Manual Testing | Other Tools |
|---|---|---|---|
| Speed | โก Seconds | ๐ Hours | โก Fast |
| Quality | โ AI-powered | ๐ค Variable | โ ๏ธ Template-based |
| Customization | โ Flexible | โ Full control | โ Limited |
| LLM Choice | โ 3 providers | N/A | โ Usually locked |
| UI + CLI | โ Both | N/A | โ ๏ธ Usually one |
| Cost | ๐ฐ Free + LLM API | ๐ฐ๐ฐ Developer time | ๐ฐ๐ฐ๐ฐ Expensive |
๐ Privacy & Security
- Your code stays yours: Code is only sent to your chosen LLM provider
- Use Ollama for local processing: 100% offline operation available
- No data storage: We don't store or log your code
- Open source: Audit the code yourself (Apache 2.0 License)
๐ ๏ธ Requirements
- Python 3.8 or higher
- Access to an LLM provider:
- Azure OpenAI (paid)
- Google Gemini (paid, but has free tier)
- Ollama (free, runs locally)
๐ Project Structure
universal-tester/
โโโ universal_tester/
โ โโโ core.py # Main test generation logic
โ โโโ cli.py # Command-line interface
โ โโโ llm/
โ โ โโโ factory.py # Multi-LLM support
โ โ โโโ health_check.py # LLM health monitoring
โ โ โโโ java_validator.py # Code validation
โ โโโ detectors/
โ โ โโโ enhanced_import_detector.py # Java import detection
โ โ โโโ kotlin_import_detector.py # Kotlin import detection
โ โโโ prompts/
โ โ โโโ prompt_builder.py # LLM prompt construction
โ โ โโโ system_prompts.py # System-level prompts
โ โ โโโ ui_messages.py # UI messages
โ โโโ ui/
โ โโโ chainlit_ui.py # Web UI implementation
โ โโโ main.py # UI entry point
โโโ USER_GUIDE.md # Complete documentation
โโโ README.md # This file
๐ค Contributing
Contributions are welcome! Here's how:
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Commit your changes:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request
๐ License
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
Note on Commercial Use: While the software is open source under Apache 2.0, commercial use requires a separate license. Contact senthilthepro@hotmail.com for commercial licensing.
Patent Notice: The author reserves all patent rights related to the concepts and methods embodied in this software.
๐ Acknowledgments
๐ง Contact & Support
- Author: Senthil Kumar Thanapal
- Email: senthilthepro@hotmail.com
- PyPI Package: https://pypi.org/project/universal-tester/
๐ Quick Links
- PyPI Package
- User Guide
- Documentation included in package
Made with โค๏ธ for the testing community
Star โญ this repo if you find it useful!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file universal_tester-1.1.1.tar.gz.
File metadata
- Download URL: universal_tester-1.1.1.tar.gz
- Upload date:
- Size: 93.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8e68c9a7b13e6cc20a8e8395a07db1940abdaec4d2c297565d5976d8813c16d0
|
|
| MD5 |
8cb4ff9efe61f6796eb043c9d2f649eb
|
|
| BLAKE2b-256 |
5149ead498efd15d7078a9f95b637dc8530492211e7245821058d802b483c365
|
File details
Details for the file universal_tester-1.1.1-py3-none-any.whl.
File metadata
- Download URL: universal_tester-1.1.1-py3-none-any.whl
- Upload date:
- Size: 91.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d293822acbe4c78d8974b31e59c9a9192413bd5770a52d20b6210dda5b971549
|
|
| MD5 |
90903cfccb260083941efde71a9735b1
|
|
| BLAKE2b-256 |
201fac6f0ed433be14915c76d6b36b90ee5390d9dc574bccc42244763c6f846d
|