使用junitreport生成报告时,发生异常的情况
2016-01-14 15:29
549 查看
通过ant中的 junitreport task来生成JUnit测试报告,target的代码如下:
可是,我在Eclipse中执行这个target的时候,却一直报下面这个错误
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,便没有这种问题,但是这种方法我没有试过。
<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,便没有这种问题,但是这种方法我没有试过。
相关文章推荐
- _WIN32_WINNT
- 【Java】生成验证码(图片、汉字)
- Pop3_解决PKIX:unable to find valid certification path to requested target 的问题
- 复制列表
- unity3d扩展编辑器
- jquery ajax 使用layer的超时提示
- iOS开发之:dispatch_async 与 dispatch_get_global_queue 的使用方法
- 系统上电后 bootloader的执行流程及 ARM Linux的启动过程分析
- 中医教你怎么睡好觉,睡个养生觉!
- Commons CLI使用
- WPF Issues
- js实例代码
- MySQL innodb表空间
- Android隐藏标题状态栏的方法
- Ubuntu出现error:unknown filesystem grub rescue解决办法
- iphone导入通讯录
- 获取sevlet response值
- 导航显示问题
- 创建型模式5之2-AbstractFactory抽象工厂模式例子理解
- Git协作流程