how can i create a html report for the junit xml report manually?

后端 未结 2 1203
既然无缘
既然无缘 2020-12-19 10:55

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 ho

相关标签:
2条回答
  • 2020-12-19 11:33

    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/"

    0 讨论(0)
  • 2020-12-19 11:45

    Given just the junit xml file (and python) you can convert the xml junit report file into a single self-contained HTML file using junit2html. https://github.com/inorton/junit2html

    I had wanted a tool that does this for quite a long time so finally sat down the other day and had a go. It is pure python so should work on any platform as a stand-alone tool.

    0 讨论(0)
提交回复
热议问题