2013-12-13 105 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測試套件的使用,而不是我使用的覆蓋工具。 –

回答