Set reortNG in build.xml

To use the reporting plug-in, set the listeners attribute of the testng element in your Ant build file. This attribute takes a comma-separated list of reporter class names. The class names for the ReportNG reporters are:

        org.uncommons.reportng.HTMLReporter
        org.uncommons.reportng.JUnitXMLReporter
     

You may also want to disable the default TestNG reporters by setting the useDefaultListeners attribute to "false".

Your Ant task will probably look something like this:

        <testng classpathref="test-path"
                outputdir="${test-results.dir}"
                haltonfailure="true"
                useDefaultListeners="false"
                listeners="org.uncommons.reportng.HTMLReporter,org.uncommons.reportng.JUnitXMLReporter">
          <xmlfileset dir="." includes="testng.xml"/>
          <sysproperty key="org.uncommons.reportng.title" value="My Test Report"/>
        </testng>
     

The reportng-1.1.2.jar and velocity-dep-1.4.jar files must be included in the classpath used to run the tests.

猜你喜欢

转载自luocb1980.iteye.com/blog/900074