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

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

created 3 years ago
265 stars

Top 97.3% 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

1 year ago

Responsiveness

1 week

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

Explore Similar Projects

Starred by Andrej Karpathy Andrej Karpathy(Founder of Eureka Labs; Formerly at Tesla, OpenAI; Author of CS 231n), Patrick von Platen Patrick von Platen(Core Contributor to Hugging Face Transformers and Diffusers), and
4 more.

yet-another-applied-llm-benchmark by carlini

0.2%
1k
LLM benchmark for evaluating models on previously asked programming questions
created 1 year ago
updated 3 months ago
Feedback? Help us improve.