2013-12-13 99 views
1

我们使用测试套件运行Sonar 3.5,并使用maven-surefire-plugin执行它们。当我们的测试使用maven编译和正确执行时,当我们对他们运行声纳时,我们仍然在SONAR中获得0.0%的测试覆盖率。任何想法我们做错了什么?0.0%测试Coverage - Sonar maven-surefire-plugin JUnit测试套件集成

Maven的万无一失,插件配置在pom.xml中:

<plugin> 
    <groupId>org.apache.maven.plugins</groupId>  
    <artifactId>maven-surefire-plugin</artifactId>  
    <configuration>  
     <test>com.myApp.AllTests</test>  
     <failIfNoTests>false</failIfNoTests> 
    </configuration> 
</plugin> 

该测试套件看起来是这样的:

package com.myApp; 

import org.junit.runner.RunWith; 
import org.junit.runners.Suite; 
import org.junit.runners.Suite.SuiteClasses; 

/** 
* 
* @author me <a href="mailto:[email protected]">Me</a> 
* 
*/ 
@RunWith(Suite.class) 
@SuiteClasses({ TestA.class }) 
public class AllTests { 

} 
+0

您应该使用emma,jacoco或其他覆盖工具 –

+0

我在想那个。在我的实现中,如果我不使用测试套件,我可以获得测试覆盖率指标。所以,我认为这个问题是Sonar测试套件的使用,而不是我使用的覆盖工具。 –

回答