`
Rainbow702
  • 浏览: 1066055 次
  • 性别: Icon_minigender_1
  • 来自: 苏州
社区版块
存档分类
阅读更多

通过ant中的 junitreport task来生成JUnit测试报告,target的代码如下:

 

<target depends="build" name="AllTests">
	<mkdir dir="${junit.output.dir}"/>
	<junit fork="yes" printsummary="withOutAndErr">
		<formatter type="xml"/>
		<test name="com.fujitsu.netproto_knowhow.testcase.AllTests" todir="${junit.output.dir}"/>
		<classpath refid="netproto_knowhow.classpath"/>
	</junit>
</target>
<target name="junitreport" depends="AllTests">
	<mkdir dir="${junit.output.report}"/>    	
	<junitreport todir="${junit.output.report}">
		<fileset dir="${junit.output.dir}">
			<include name="TEST-*.xml"/>
		</fileset>
		<report format="frames" todir="${junit.output.report}"/>
	</junitreport>
</target>

可是,我在Eclipse中执行这个target的时候,却一直报下面这个错误

[junitreport] Processing F:\Workspaces\HTML5\netproto_knowhow\ant\junit\20130410092003\html\TESTS-TestSuites.xml to C:\Users\WANGZH~1\AppData\Local\Temp\null1293654028
[junitreport] Loading stylesheet jar:file:/F:/Development_Tools/eclipse-jee-juno-SR2-win32/plugins/org.apache.ant_1.8.3.v201301120609/lib/ant-junit.jar!/org/apache/tools/ant/taskdefs/optional/junit/xsl/junit-frames.xsl
[junitreport] : Error! The first argument to the non-static Java function 'replace' is not a valid object reference.
[junitreport] : Error! Cannot convert data-type 'void' to 'reference'.
[junitreport] : Fatal Error! Could not compile stylesheet
[junitreport] Failed to process F:\Workspaces\HTML5\netproto_knowhow\ant\junit\20130410092003\html\TESTS-TestSuites.xml

  Eclipse中,我的JRE版本是 1.6 U39,ant 版本是1.8.3,JUnit版本是4.10.

 

  百度了很长时间,没有找到答案。

  换谷歌,终于在stackoverflow上找到了一个解决方案:

  http://stackoverflow.com/questions/10536095/ant-junit-build-error-inside-eclipse

  按照上面的贴子中的想法,我变通了一下,将我自己的JRE版本换成了1.5的,便不会再现上面的这个问题。

  但是,由于JUnit4.10与JRE5不兼容,所以,需要换成JUnit3,或者JUnit4的低版本。

 

   大家也可以试试JRE6的低版本,比如,JRE6 u26 等等,也是可以的。

 

 

   网上还有一种做法,就是不在Eclipse中执行ant,便没有这种问题,但是这种方法我没有试过。

 

分享到:
评论

相关推荐

    雾山的Robotium学习笔记---使用junitreport导出测试报告

    雾山的Robotium学习笔记---使用junitreport导出测试报告http://blog.csdn.net/tt75281920/article/details/29852517

    JUnit Ant Eclipse, JUnitReport报告

    博文链接:https://congpeixue.iteye.com/blog/208377

    jasmine-xml-reporter:Jasmine 2的--junitreport和--output命令行参数

    该模块使用模块生成JUnit XML报告(当存在--junitreport参数时),并且可以选择将生成的文件放在--output参数所指定的文件夹中。 安装 与任何节点模块一样简单: npm install jasmine-xml-reporter 用法 要仅使用...

    android-junit-report-1.0.3

    将AndroidManifest.xml文件中的TestRunner改成com.zutubi.android.junitreport.JUnitReportTestRunner就可以自动生成xml报告文件

    ant junit report 自定义

    ant junit report 自定义

    Frisby-for-DM-test:使用 Frisby.js 测试 DM

    Frisby-for-DM-测试在localhost 443/8080端口运行DM/WEB服务器,然后启动frisby进行测试。 命令: jasmine-node spec --junitreport 通过 --junitreport 生成测试报告

    test2junit:以Junit XML格式发出Clojure测试输出,并可以选择自动调用HTML生成

    这些文件可以与junitreport一起使用,以创建HTML格式的报告。 您可以通过project.clj文件来调整一些设置: ; specify your output directory :test2junit-output-dir " test-results " ; to run ant ...

    reportng-Release-1.1.4.zip

    TestNG 自带的那个 Reporter 生成的 HTML 网页太寒碜了, 这个 ReportNG 弄出来的就漂亮多了,而且也支持生成 JUnit XML report,这样 junitreport 仍然能用上。

    android-junit-report-dev

    5、 将编译生成的应用apk和tests的apk安装到手机板卡中(编译应用apk的时候需要加上参数PRODUCT_HAS_TESTS=1用于计算覆盖率) 6、 执行命令:adb shell am instrument -e coverage true -w ...

    frisby-tryout

    Frisbyjs - 测试项目要求节点设置npm install执行测试./node_modules/jasmine-node/bin/jasmine-node my_spec.js或者,生成测试报告(即对于 Jenkins): ./node_modules/jasmine-node/bin/jasmine-node my_spec.js ...

    hibernate-2.1.8.part1.rar

    (3) run "ant junitreport" or "build junitreport" (4) see testout/index.html Legal ----------- This software is distributed under the terms of the FSF Lesser Gnu Public License (see lgpl.txt). This...

    hibernate-2.1.8.part3.rar

    (3) run "ant junitreport" or "build junitreport" (4) see testout/index.html Legal ----------- This software is distributed under the terms of the FSF Lesser Gnu Public License (see lgpl.txt). This...

    hibernate-2.1.8.part2.rar

    (3) run "ant junitreport" or "build junitreport" (4) see testout/index.html Legal ----------- This software is distributed under the terms of the FSF Lesser Gnu Public License (see lgpl.txt). This...

    hibernate3.2

    (3) run "ant junitreport" or "build junitreport" (4) see build/test-reports/index.html Other Stuff ----------- This software is distributed under the terms of the FSF Lesser Gnu Public License ...

    github-issue-junit:阅读来自Travis的JUnit HTML输出并在GitHub上的一个未解决问题上添加评论

    在gh-pages分支中,以帧格式运行ant junitreport目标。 参见 。 最主要的是在可访问的位置创建JUnit HTML摘要页面。 在您的GitHub存储库中创建一个问题,该问题将随测试结果更新。 参见 为该问题创建一个标签,以...

Global site tag (gtag.js) - Google Analytics