3.28.2. Configuring code coverage for an AUT
Prev | 3.28. Working with code coverage with Java tests | Next

### 3.28.2. Configuring code coverage for an AUT

You can activate code coverage for an AUT configuration with the following steps:

1. Open the AUT configuration dialog from the Project properties (Section 3.6.3, “Editing the Project and AUT properties”).

2. Select the Expert configuration.

3. Select the code coverage agent you wish to use (JaCoCo is available out-of-the-box).

4. You can then enter the AUT installation directory and the AUT source directory for the code coverage:

   The AUT installation directories

     are the directories containing the class files (compiled Java files) for your AUT. You must select these directories or files (jar or class) to make code coverage possible for your test run.

   The AUT source directories

     are the directories where the source files (i.e. the program code) for your AUT are kept. Adding a directory for the source files is optional, however, if you don't add one, then you will not be able to view your code coverage results at the source file level. The AUT source directories must contain the source files in their Java package structure. The class files must have been compiled with debug information to make the lines of code executed visible in the code coverage report.

5. To make sure you only monitor your own code, enter one or more package pattern divided by ; to specify which packages should be monitored. The pattern must be a valid regular expression. If you do not enter a package pattern, all classes in the virtual machine will be considered for the code coverage value.

   | Not entering a package pattern can result in extremely large messages being sent from the AUT Agent, which may cause memory problems (Section 3.28.2.1, “Increasing the Java Heap Space for code coverage”).

6. Select whether you want the code coverage value to be reset when a new Test Suite starts (Section 3.28.3, “Resetting and accumulating code coverage”).

7. During code coverage class file id collision can happen, if different classes are found with the same name. If you don't want to allow the collision, be sure the 'Allow class file id collision' checkbox is unchecked. It's unchecked by default. If the feature is enabled, you will only get a log entry, if an error is occurred. Bear in mind in case of enabled state, the jacoco monitoring report can be invalid.

#### 3.28.2.1. Increasing the Java Heap Space for code coverage

Running a test with a code coverage profiler leads to an increased memory requirement for the ITE. You can increase the heap space for the ITE and also enter a package pattern (Section 3.28.2, “Configuring code coverage for an AUT”) to reduce the amount of files considered for code coverage.

| Users working with a MySQL database should also follow the steps from the Installation Manual to increase the maximum allowed packet for the database.