auto-unit-test-case-generator  by traas-stack

JUnit test suite generator for Java code, used within ANT Group

Created 3 years ago
266 stars

Top 96.2% on SourcePulse

GitHubView on GitHub
Project Summary

This project provides an automated tool for generating JUnit test suites for Java code, aiming for high branch and line coverage. It is designed for Java developers and teams seeking to improve test suite quality and reduce manual effort, with a proven track record in ANT Group supporting over 1000 projects.

How It Works

The generator is built upon EvoSuite, employing Search-Based Software Testing (SBST) as its core framework. It introduces optimized algorithms to address performance issues with large search spaces (e.g., extensive String usage) and improve efficiency. Additionally, it incorporates an optimal call sequence algorithm for more readable and logical test case structures, and specifically handles Spring Framework dependencies by generating mock statements for autowired fields to prevent NullPointerException.

Quick Start & Requirements

  • Install via Maven: mvn clean install -Dmaven.test.skip=true
  • Copy generated JAR: cp ${user.home}/.m2/repository/org/smartut/smartut-master/1.1.0/smartut-master-1.1.0.jar smartut.jar
  • Project dependencies preparation: mvn clean compile, mvn clean install -Dmaven.test.skip=true, mvn dependency:copy-dependencies
  • Setup command: java -jar ./smartut.jar -setup <project_classes_path> <dependency_jars_path>
  • Generation commands: java -jar ./smartut.jar -class <fully_qualified_class_name> or java -jar ./smartut.jar -target <classes_folder_path>
  • Requires Java Development Kit (JDK) and Apache Maven.

Highlighted Details

  • Achieves average line coverage over 60% within Ant Group.
  • Generates effective assertions suitable for practical use.
  • Optimized for Spring Framework, including mock generation for autowired fields.
  • Employs an accurate search algorithm for improved efficiency and effectiveness.
  • Produces test cases with better readability and logical structure.

Maintenance & Community

Contact email: smartunit_opensource@service.alipay.com. A SaaS offering is available at https://smartunit.opentrs.com for full lifecycle test case management.

Licensing & Compatibility

The README does not explicitly state the license. Compatibility for commercial use or closed-source linking is not specified.

Limitations & Caveats

The project is primarily focused on Java and its effectiveness may vary with highly complex or unconventional codebases. The README does not detail specific limitations or known issues.

Health Check
Last Commit

2 years ago

Responsiveness

Inactive

Pull Requests (30d)
0
Issues (30d)
0
Star History
1 stars in the last 30 days

Explore Similar Projects

Starred by Andrej Karpathy Andrej Karpathy(Founder of Eureka Labs; Formerly at Tesla, OpenAI; Author of CS 231n), Edward Z. Yang Edward Z. Yang(Research Engineer at Meta; Maintainer of PyTorch), and
5 more.

yet-another-applied-llm-benchmark by carlini

0.1%
1k
LLM benchmark for evaluating models on previously asked programming questions
Created 1 year ago
Updated 6 months ago
Starred by Chip Huyen Chip Huyen(Author of "AI Engineering", "Designing Machine Learning Systems"), Meng Zhang Meng Zhang(Cofounder of TabbyML), and
3 more.

qodo-cover by qodo-ai

0.1%
5k
CLI tool for AI-powered test generation and code coverage enhancement
Created 1 year ago
Updated 4 months ago
Feedback? Help us improve.