Why source file of the tested class covered by test can not be found in model.

Hi,

I'm integrating Clover tests optimization feature into Hadoop core projects and have issue with some tests which are not optimized and included into each tests run with following messages:

[INFO] Source file org/apache/hadoop/yarn/server/api/records/impl/pb/HeartbeatResponsePBImpl.java covered by test org.apache.hadoop.yarn.TestRecordFactory.testPbRecordFactory not found in model.

The test class and source of tested class are located in different modules. But I'm using clover configuration that is adjusted for multi-model projects. See below maven profile example.

This is only one example there are 36 such classes.

The Clover version 3.0.2 and Maven clover plugin version 3.0.5 are used

What can be the cause of this issue?

Below is profile sample which is defined in parent maven pom :

<profile>

<id>clover.optimize</id>

<activation>

<activeByDefault>false</activeByDefault>

<property>

<name>clover.optimize</name>

</property>

</activation>

<properties>

<cloverLicenseLocation>${user.home}/.clover.license</cloverLicenseLocation>

<clover.snapshot>${project.basedir}/.clover/clover.snapshot</clover.snapshot>

</properties>

<build>

<plugins>

<plugin>

<groupId>com.atlassian.maven.plugins</groupId>

<artifactId>maven-clover2-plugin</artifactId>

<configuration>

<outputDirectory>${project.build.directory}/clover</outputDirectory>

<licenseLocation>${cloverLicenseLocation}</licenseLocation>

<snapshot>${clover.snapshot}</snapshot>

<includesAllSourceRoots>true</includesAllSourceRoots>

<singleCloverDatabase>true</singleCloverDatabase>

<instrumentation>method</instrumentation>

</configuration>

<executions>

<execution>

<id>clover</id>

<goals>

<goal>setup</goal>

<goal>optimize</goal>

<goal>snapshot</goal>

</goals>

</execution>

</executions>

</plugin>

<plugin>

<groupId>org.codehaus.mojo</groupId>

<artifactId>groovy-maven-plugin</artifactId>

<version>1.4</version>

<executions>

<execution>

<phase>process-test-classes</phase>

<goals>

<goal>execute</goal>

</goals>

<configuration>

<source>

def tests = project.properties['test'];

log.info("Tests to run: " + tests);

if (tests != null &amp;&amp; tests.length() == 0) {

log.info("No tests to run");

project.properties['skipTests'] = 'true';

}

</source>

</configuration>

</execution>

</executions>

</plugin>

</plugins>

</build>

</profile>

1 answer

This widget could not be displayed.

Hi Dmitry,

1) You wrote:

"The Clover version 3.0.2 and Maven clover plugin version 3.0.5 are used"

Have you tried to use the latest 3.1.7 version? And what do you exactly mean by statement that Clover 3.0.2 and maven-clover2-plugin 3.0.5 were used - different versions at the same time?

2) Does the HeartbeatResponsePBImpl.java file exist? Did you made some refactoring? A message like below:

Source file org/apache/hadoop/yarn/server/api/records/impl/pb/HeartbeatResponsePBImpl.java covered by test org.apache.hadoop.yarn.TestRecordFactory.testPbRecordFactory not found in model

is printed at DEBUG logging level and it means that some test case is/was related with an application class which does not exist anymore (or was not instrumented) - that's why it is not found in clover.db model.

In case of code refactoring it might be a normal behaviour, because optimization snaphsot is being updated incrementally during test runs, so after some period of time it can contain information about classes, which do not exist anymore.

I suggest the following:

  • remove the optimization snapshot file and execute full test run in order to get up-to-date snapshot
  • configure the <fullRunEvery> attribute and set some reasonable value (default: 10), depending on how intensive code refactoring you're making

Regards
Marek

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted yesterday in Teamwork

What teamwork quotes inspire you?

Hey everyone! My name is Natalie and I'm an editor of the Atlassian Blog and I've got a question for you: What's your favorite quote about teamwork?  We've compiled a list here, along with...

28 views 3 4
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you