我如何手动创建一个junit xml报告的html报告? [英] how can i create a html report for the junit xml report manually?

查看:665
本文介绍了我如何手动创建一个junit xml报告的html报告?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我运行junit并在Junit控制台显示结果,然后我执行导出结果,它被保存为一些test.xml。现在我想生成一个HTML报告,我该如何做?我的项目是复杂的,我不能做一个正常的

 < target name =testdepends =run-tests > 
< junitreport todir =$ {reports}>
< fileset dir =$ {reports} / raw />
< include name =TEST - *。xml/>
< / fileset>
< report format =framestodir =$ {reports} \html\/>
< / junitreport>
< / target>

任何可用于将结果转换为html格式的工具。

解决方案

不是100%确定你在问什么,但是这里是我的ant代码,用于执行JUnit批处理测试,然后是使用XML的HTML报告格式化程序...

 < junit showoutput =onprintsummary =onfork =falsehaltonfailure =false 
failureproperty =unittest.failure>
< classpath>
< pathelement path =$ {build.classpath}/>
< pathelement path =$ {classes}/>
< / classpath>
< batchtest todir =$ {unittests.results}>
< fileset dir =$ {classes}>
< include name =$ {batchtest.prefix}@{test}_test.class/>
< / fileset>
< formatter type =xml/>
< / batchtest>
< / junit>
< junitreport todir =$ {unittests.results}>
< fileset dir =$ {unittests.results}/>
< report todir =$ {unittests.results}/>
< / junitreport>

请注意@ {test}是因为它在build.xml文件中的一个宏定义的一部分。



从你在问题中所说的话,它不确定你是否使用< formatter type =xml>

无论如何希望有所帮助



哦,不要混合你的斜杠 $ {reports} \html\> $ {reports} / html /


I have run junit and it shows the results in Junit console, then i do a export of the result, it is saved as some test.xml. now i want to generate a html report out of it how do i do it ? MY project is complex and i cant do as a normal

<target name ="test" depends="run-tests">
    <junitreport todir="${reports}">
        <fileset dir="${reports}/raw/">
            <include name="TEST-*.xml"/>
        </fileset>
        <report format="frames" todir="${reports}\html\"/>
    </junitreport>
</target>

anybody any tool that can be used to convert the results in xml to a html format.

解决方案

Not 100% sure what you're asking but heck here's my ant code for doing a JUnit batch test then a HTML report using the XML formatter...

   <junit showoutput="on" printsummary="on" fork="false" haltonfailure="false"
    failureproperty="unittest.failure">
    <classpath>
      <pathelement path="${build.classpath}"/>
      <pathelement path="${classes}"/>
    </classpath>
    <batchtest todir="${unittests.results}">
      <fileset dir="${classes}">
        <include name="${batchtest.prefix}@{test}_test.class" />
      </fileset>
      <formatter type="xml"/>
    </batchtest>
  </junit>
  <junitreport todir="${unittests.results}">
    <fileset dir="${unittests.results}"/>
    <report todir="${unittests.results}"/>
  </junitreport>

note that the @{test} is because its part of a macrodef within the build.xml file.

From what you said in the question, its unsure if you're using the <formatter type="xml">.

Anyway hope that helps

oh and dont mix your slashes ${reports}\html\" > ${reports}/html/"

这篇关于我如何手动创建一个junit xml报告的html报告?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆