Sca*_*rog 3 ant code-coverage cobertura junit4
是的,这是0%覆盖范围内的另一个.我检查并确认了以下内容:
1)...程序确实正在生成相应的cobertura.ser文件,并且该文件和Instrumented目录的内容已经消失,根据http://cobertura.sourceforge.net/faq.html.
2)......"仪表化"是Cobertura测试中确定的第一个类路径.
3)......我的测试套件中确实正在测试线路,并且...
4)......确实正在创建和编写"已检测"目录 - 我看到了这一点.
有点奇怪的是,我注意到Ant生成的报告只是一系列消息:
Testcase: pluralizeIt[0] took 0.004 sec
Caused an ERROR
Instruction type does not match stack map in method StringUtil.main([Ljava/lang/String;)V at offset 50
java.lang.VerifyError: Instruction type does not match stack map in method StringUtil.main([Ljava/lang/String;)V at offset 50
at PluralTest.pluralizeIt(PluralTest.java:55)
Run Code Online (Sandbox Code Playgroud)
但是如果我注释掉所有Cobertura引用和目标,那么测试运行正常,Ant报告在成功和失败方面给了我100%的预期.
我的build.xml文件在下面...任何想法??? 谢谢....
<?xml version="1.0" encoding="UTF-8"?>
<project name="TestPlurazliation" default="coverage" basedir=".">
<property name="src" location="src" />
<property name="build" location="bin" />
<property name="cobertura" location="/Users/Dauber/Desktop/cobertura-1.9.4.1" />
<property name="instrumented" location="instrumented" />
<property name="coverage.xml" location="coverage-xml" />
<property name="coverage.html" location="coverage-html" />
<path id="cobertura.classpath">
<fileset dir="${cobertura}">
<include name="cobertura.jar" />
<include name="lib/**/*.jar" />
</fileset>
</path>
<taskdef classpathref="cobertura.classpath" resource="tasks.properties" />
<target name="init">
<tstamp />
<mkdir dir="${build}" />
</target>
<target name="compile" depends="init">
<javac srcdir="/Volumes/Junk/Java projects/SE433/TestingPluralization/src" includeantruntime="false" debug="on" destdir="${build}">
<classpath location="/Users/Dauber/Desktop/junit-4.10.jar" />
</javac>
</target>
<target name="PluralizationTest" depends="compile">
<junit printsummary="yes" fork="yes" haltonfailure="yes">
<classpath location="/Users/Dauber/Desktop/junit-4.10.jar" />
<classpath location="${build}" />
<formatter type="plain" />
<test name="PluralTest" />
</junit>
</target>
<target name="instrument" depends="init,compile">
<delete file="cobertura.ser" />
<delete dir="${instrumented}" />
<cobertura-instrument todir="${instrumented}">
<ignore regex="org.apache.log4j.*" />
<fileset dir="bin">
<include name="**/*.class" />
<exclude name="**/*Test*.class" />
</fileset>
</cobertura-instrument>
</target>
<target name="PluralizationTest2" depends="init,compile">
<junit fork="yes">
<classpath location="${instrumented}" />
<classpath location="${build}" />
<classpath location="/Users/Dauber/Desktop/junit-4.10.jar" />
<classpath refid="cobertura.classpath" />
<formatter type="plain" />
<test name="PluralTest" />
</junit>
</target>
<target name="coverage-report-xml">
<cobertura-report srcdir="${src}" destdir="${coverage.xml}" format="xml" />
</target>
<target name="coverage-report-html">
<cobertura-report srcdir="${src}" destdir="${coverage.html}"/>
</target>
<target name="coverage" depends="compile,instrument,PluralizationTest2,coverage-report-xml,coverage-report-html" />
<target name="clean" description="clean up" >
<delete dir="${build}"/>
<delete dir="${instrumented}"/>
</target>
</project>
Run Code Online (Sandbox Code Playgroud)
小智 5
如果您使用的是JDK 7,则需要添加UseSplitVerifier JVM参数:
<jvmarg value="-XX:-UseSplitVerifier"/>
Run Code Online (Sandbox Code Playgroud)
(注意:我将此作为评论的答案添加,以便其他人可以轻松找到解决方案.)
| 归档时间: |
|
| 查看次数: |
3553 次 |
| 最近记录: |