Unit Testing and Code Coverage

The test driven approach an important part of Agile methodology, benefits development in a number of ways. It helps you to make your code design clearer and to continuously ensure its quality. IntelliJ IDEA offers amazing tools and code assistance features for designing, running, and debugging unit tests on Java, JavaScript, Flex, Android, PHP and other platforms.

Run and Debug Unit Tests

IntelliJ IDEA lets you easily run and debug unit tests. You can see the results, compare difference for assertEquals, and jump to any test definition or error line. Support of unit testing frameworks includes JUnit, TestNG, Groovy JUnit, FlexUnit, JSTestDriver and others.

Easy Project Setup

Unit Tests Configuration

you have a lot of flexibility in running your unit tests. You can run tests from directory, package, group or even by pattern.

Easy Project Setup

The fork mode for JUnit allows you to run each test method or class in a separate process.

Code Navigation

Navigate quickly between classes and corresponding tests with a shortcut or create a test class with one click.

On-the-fly Code Analysis

Unit Tests Generation

IntelliJ IDEA will create a unit test for your class. Just specify the unit testing framework, destination package and method you want to test.

On-the-fly Code Analysis

Code Completion and On-the-fly Analysis

IntelliJ IDEA also provides additional code assistance for developing unit tests, such as code completion, libraries configuration and on-the-fly analysis with quick-fixes.

On-the-fly Code Analysis

Code Coverage Ultimate

IntelliJ IDEA enables you to measure and analyse detailed coverage statistics for your code.

Coverage statistics is available on the fly for each class and package, with exact percentage of methods and lines of code covered by unit tests.

Enterprise Java Beans 3.1

You can even see coverage information for each line of code, right in the editor.

Web Services

These features give you a very accurate picture of coverage in your project, so you will never miss a single line of code uncovered by unit tests.

Coverage Configuration Ultimate

By default, IntelliJ IDEA uses its own coverage engine. But you can also choose JaCoCo engine for calculation coverage.

Web Services

Coverage Reports Ultimate

A dedicated tool window provides detailed coverage report for your project. You can browse packages, navigate to sources, or even export coverage report to HTML file.

Web Services

IntelliJ IDEA stores coverage data locally in files, so you can open coverage data from file and check it with your project files.

Web Services

For instance, you can use it for browsing coverage statistics from another machine.

Getting Started

Find how to use IntelliJ IDEA for developing unit tests and analysing coverage with our tutorial.