我定义了以下 Sonar Ant 目标:
<target name='sonar'>
<property name='sonar.sources' value='${src.dir}'/>
<property name='sonar.tests' value='${test.src.dir}'/>
<property name='sonar.binaries' value='build/classes'/>
<path id='jars'>
<fileset dir='${env.JAVA_HOME}/jre/lib' includes='*.jar'/>
<fileset dir='build/lib/test' includes='*.jar'/>
</path>
<pathconvert property='sonar.libraries' refid='jars' pathsep=','/>
<exec executable='p4' outputproperty='p4.P4CLIENT'>
<arg value='set'/>
<arg value='P4CLIENT'/>
</exec>
<propertyregex
property='p4client'
input='${p4.P4CLIENT}'
regexp='P4CLIENT=([^ ]+) *.*'
replace='\1'/>
<propertyregex
property='sonar.timestamp'
input='${build.time}'
regexp='_'
replace='T'/>
<sonar:sonar key='com.netflix:${module.name}' version='${p4client}@${sonar.timestamp}' xmlns:sonar='antlib:org.sonar.ant'/>
<property name='sonar.dynamicAnalysis' value='reuseReports'/>
<property name='sonar.emma.reportPath' value='${coverage.dir}'/>
</target>
当我在浏览器中运行“ant sonar”并打开 Sonar 时,我看到了 src 目录中有关类的信息,但没有看到 test 目录中的内容。
如果我将 ${test.src.dir} 添加到 sonar.sources 而没有设置 sonar.tests,我会看到一些有关测试类的信息,但 Sonar 仍然报告 0 测试成功。
我如何获得它,以便深入了解每种测试方法及其统计信息?