Skip to content

Tool that generates unit test for Java, trying to reach all branches and maximize code coverage

License

Notifications You must be signed in to change notification settings

ErshovVladislav10M/UTBotJava

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UTBot Java: build and run tests Plugin and CLI: publish as archives

👉 Find UTBot Java on JetBrains Marketplace.

👉 Visit the official UTBot website.

What is UTBot Java?

UTBot Java is the tool for automated unit test generation. It produces ready-to-use test cases for Java — with valid inputs and comments. It can even predict whether the tests fail or pass. You can analyze them, run them, show coverage — as if you've created them personally.

The symbolic execution engine paired with a smart fuzzing technique constitutes the core of UTBot Java. It helps to find errors and prevent regressions in the code in a much more efficient way — UTBot Java maximizes path coverage while minimizing the number of tests and false positives.

UTBot Java represents all the test summaries in a human-readable format. The intelligible test method names and comments help you to control the whole testing process. Test failed? The summary refers you to the related branch or the condition under test.

Get started

Try the online demo to generate unit tests with one click.

Get to know the full version of UTBot Java plugin with this quick guide:

Install UTBot Java plugin for IntelliJ IDEA

Try the most straightforward path to start using UTBot plugin.

  1. Open your IntelliJ IDEA. If you don't have one, get it from JetBrains.
  2. Go to File → Settings... → Plugins → Marketplace.
  3. In the search field type UTBot — you'll see the UnitTestBot plugin page.
  4. Press the Install button and wait until it changes to Installed, then click OK.

Now you can find the UTBot plugin enabled in the File → Settings → Plugins window.


Generate tests with default configuration

Proceed to generating unit tests for the existing Java project. If you don't have one, create it using the JetBrains tutorial.

  1. Open your Java project in IntelliJ IDEA.
  2. Right-click the required package or a file in the Project tool window, scroll the menu down to the bottom and choose Create Tests with UTBot...
  3. In the Generate tests with UTBot window tick the classes or methods you'd like to cover with unit tests and press OK.

Now you can see the resulting test class or classes in the Editor tool window.


Make use of generated tests

What can you do with the output?

  1. To find and fix the errors in your code:
  • Run the generated tests: right-click the test class or a folder with tests and choose Run.

  • In the Run tool window you can see the tests failed with the brief failure explanation.

  • Fix your errors if needed.

  1. To prevent regressions:
  • Having your errors fixed, run the tests again. "Passed"? Commit them as the regression suite.

  • Introduce changes in the code and run your tests as often as needed!

  • Tests failed? Decide whether it is a bug or a feature and generate new tests if necessary.

  1. To view coverage:

Right-click the test class, choose More Run/Debug → Run ... with Coverage.


Contribute to UTBot Java

UTBot Java is an open source project. We welcome everyone who wants to make UTBot Java better — introduce a new feature or report a bug. We have only one kind request for our contributors: we expect you to prove the necessity and quality of the suggested changes.

How can you do this? Refer to our Contributing guide.

Feel free to join the Discussions!

And thank you for your time and effort! ⭐

Find support

Having troubles with using UTBot Java? Contact us directly.

Find more UTBot products

UTBot Cpp — try it yourself and tell your friends: it is the tool for automated unit test generation developed especially for C/C++.

You are welcome to contribute to it too!

About

Tool that generates unit test for Java, trying to reach all branches and maximize code coverage

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Kotlin 84.2%
  • Java 14.0%
  • Other 1.8%