Search code examples
htmljunitantreport

How to send junit report via email as report doesn't display


I have a Junit HTML Report below in my local which is built through ANT:

Now the problem I am having is that if I try and attach this report by simply sending just the index.html, it will display this:

I want to know how can I send the above report via email so everyone can see the html report. I only want to send the index.html I don't want to send everybody the corresponding files.

The xml code to build this report is below (I xxx out some things which are not xxx in the real file):

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- WARNING: Eclipse auto generated file.
          Any modifications will be overwritten.
          To include a user specific buildfile here, simply create one in the same
          directory with the processing instruction <?eclipse.ant.import?>
          as the first entry and export the buildfile again. -->

<project basedir="." default="Test_Report" name="Test_Report">


<target name="xxx_SoapUI">
 <exec dir="." executable="C:\Program Files\SmartBear\SoapUI-5.3.0\bin\testrunner.bat">
 <arg line="-r -j -f 'D:\xxx\xxx' 'D:\xxx).xml'"></arg>
</exec>
</target>

    <target name="xxx_SoapUI">
 <exec dir="." executable="C:\Program Files\SmartBear\SoapUI-5.3.0\bin\testrunner.bat">
 <arg line="-r -j -f 'D:\xxx\xxx' 'D:\xxx).xml'"></arg>
</exec>
</target>

    <target name="xxx_SoapUI">
 <exec dir="." executable="C:\Program Files\SmartBear\SoapUI-5.3.0\bin\testrunner.bat">
 <arg line="-r -j -f 'D:\xxx\xxx' 'D:\xxx).xml'"></arg>
</exec>
</target>


</project>

Solution

  • The format="frames"attribute normally generates separate files for frames and maybe stylesheets. As mentioned in the task documentation, you can set the value to noframes and Ant will generate the report in a single HTML:

    The noframes format does not use redirecting and generates one file called junit-noframes.html.

    In case you need to customize the XSL used to generate the report, you can override it using the styledir attribute (note that the file must be named junit-noframes.xsl). The default XSL is embedded in the Ant source code and can be viewed here.