Skip to content

Auto-Unit-Test-Case-Generator automatically generates high-level code-coverage JUnit test suites for Java, widely used within the ANT Group.

License

Notifications You must be signed in to change notification settings

pandaDevs/auto-unit-test-case-generator

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

What is Auto-Unit-Test-Case-Generator

Auto-Unit-Test-Case-Generator generates JUnit test suites for Java class just as its name. During test generation, Auto-Unit-Test-Case-Generator aims to generate high code-coverage (e.g., Branch Coverage and Line Coverage) unit test suites with full automation. This tools is widely used in ANT Group, supports automatic generation of unit tests for more than 1000 projects. Advantages of Auto-Unit-Test-Case-Generator:

  • High coverage and assertion level

The average line coverage within Ant Group by using the generator is over 60% The unit test generated by this tool is highly effective assertions during the practice in Ant Group

  • Easy to use

The process of generation of this tool is fully automated.

Main Features

Auto-Unit-Test-Case-Generator is developed based on EvoSuite. In Auto-Unit-Test-Case-Generator, we optimized several algorithms to achieve higher code coverage, more efficiency and effectiveness, better structure of test case. Main Features of Auto-Unit-Test-Case-Generator:

  • Suitable for Spring Framework

In Auto-Unit-Test-Case-Generator, we can generate complete mock statements for autowired fields to form meaningful test case, avoid throwing NullPointerException.

  • More efficiency and effectiveness

Like EvoSuite, Auto-Unit-Test-Case-Generator also use the Search Based Software Testing(SBST) as main algorithm framework. However, random search algorithm will encounter performance problems when class under test uses lots of String which has almost infinite search space. In Auto-Unit-Test-Case-Generator, we proposed and achieved accutare search algorithm to achieve higher efficiency and effectiveness.

  • Better structure of test case

In Auto-Unit-Test-Case-Generator, the optimal call sequence algorithm is used through the initialization, insertion, modification and deletion of test case statements, so that the structure of test case is more readable and logical.

Software-as-a-Service (SaaS)

Auto-Unit-Test-Case-Generator is also providing Software-as-a-Service (SaaS). Check out our SaaS website. It supports the full lifecycle/evolution of unit test cases, including test case generation, execution,iteration and regression analysis . All stages are triggered automatically by simply providing Github or Gitee link.

Building Auto-Unit-Test-Case-Generator

To build Auto-Unit-Test-Case-Generator on the command line, install maven and then call:

mvn compile

To create a binary distribution that includes all dependencies you can use Maven as well:

mvn package

To install Auto-Unit-Test-Case-Generator by using Maven, run:

mvn install -Dmaven.test.skip=true

Using Auto-Unit-Test-Case-Generator

Setup

To generate unit test suites, the generator needs to add SUT(software under test) and dependencies to class path. Commonly, for a MAVEN project, classes file and dependencies located in the target folder.

java -jar ./smartut.jar -setup example/target/classes/ example/target/dependency/*.jar

Generate for entire folder

You can run this command to generate unit test suites for all classes in classes folder:

java -jar ./smartut.jar -Dctg_cores=2 -Dctg_memory=4000 -target example/target/classes/

Generate for a specific class

You can run this command to generate unit test suites for a specific class

java -jar ./smartut.jar -Dctg_cores=2 -Dctg_memory=4000 -Dcuts=com.alipay.test.example

parameters

ctg_cores [required]

This parameter controls how many how many CPU cores used for test generation Minimum number of this parameter is 1 Do not use all cores of the device for test generation! example:

-Dctg_cores=2

ctg_memory [required]

This parameter controls how many how many memories used for test generation We recommend that each core should have 2000MB memories. Do not use all memories of the device for test generation! example:

-Dctg_memory=2000

About

Auto-Unit-Test-Case-Generator automatically generates high-level code-coverage JUnit test suites for Java, widely used within the ANT Group.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 99.2%
  • JavaScript 0.5%
  • CSS 0.1%
  • R 0.1%
  • Python 0.1%
  • Shell 0.0%