[selenium-users] Issue with generating testng XSLT report from build.xml file

24 views
Skip to first unread message

Peter Gale

unread,
Oct 10, 2014, 8:00:42 AM10/10/14
to seleniu...@googlegroups.com

This is not a Selenium. Please ask on a TestNg forum/group.

On Oct 10, 2014 12:53 PM, santosh M <santosh...@gmail.com> wrote:
Hi Selenium users,

Currently I am able to compile, run the script through testng build.xml from cmd, but not able to generate testNg XSLT reports from build.xml.

Below build.xml file I am using.

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE project [
]>

<project name="MFPTestProject" basedir=".">
    <!-- ========== Initialize Properties =================================== -->
        <property environment="env"/>
        <property name="ws.home" value="${basedir}"/>
        <property name="test.dest" value="${ws.home}/build"/>
        <property name="test.src" value="${ws.home}/src"/>
        <property name="ws.jars" value="${basedir}/lib"/>
        <property name="browser" value="/usr/bin/google-chrome"/>

        <!-- ====== For setting the classpath ====  -->
        <target name="setClassPath" unless="test.classpath">
            <path id="classpath_jars">
                <fileset dir="${ws.jars}" includes="*.jar"/>
            </path>
             <pathconvert pathsep=":" property="test.classpath" refid="classpath_jars"/>
        </target>
        <!-- ============ Initializing other stuff ===========  -->
        <target name="init" depends="setClassPath">
        <taskdef name="testng" classpath="${test.classpath}" classname="org.testng.TestNGAntTask" />
        </target>
        <!-- cleaning the destination folders -->
        <target name="clean">
            <delete dir="${test.dest}"/>
        </target>
        <!-- target for compiling the java files -->
        <target name="compile" depends="init, clean" >
            <delete includeemptydirs="true" quiet="true">
                <fileset dir="${test.dest}" includes="**/*"/>
            </delete>
            <echo message="making directory..."/>
            <mkdir dir="${test.dest}"/>

            <echo message="compiling..."/>
            <javac
                debug="true"
                destdir="${test.dest}"
                srcdir="${test.src}"
                target="1.6"
                classpath="${test.classpath}"
                includeantruntime="true"
            >
            </javac>
          </target>
        <!-- run -->
        <target name="run" depends="compile">
            <testng classpath="${test.classpath}:${test.dest}" suitename="InitialTestSuite">
               <xmlfileset dir="src/com/iFocus/mfp/triggerexecution/" includes="Websites.xml"/>
            </testng>
        </target>
        <!--  ========== Generating reports using XSLT utility ==============    -->
        <target name="testng-xslt-report">
                    <delete dir="${basedir}/ReportFiles">
                    </delete>
                    <mkdir dir="${basedir}/ReportFiles">
                    </mkdir>
                    <echo message="Generating XSLT report..."/>
            <xslt in="${basedir}/test-output/testng-results.xml" style="${basedir}/configurations/testng-results.xsl" out="${basedir}/ReportFiles/MFP_AutomationReport.html">
                 <param expression="${basedir}/ReportFiles/" name="testNgXslt.outputDir" />
                 <param expression="true" name="testNgXslt.sortTestCaseLinks" />
     
                 <param expression="FAIL,SKIP,PASS,CONF,BY_CLASS" name="testNgXslt.testDetailsFilter" />
     
                 <param expression="true" name="testNgXslt.showRuntimeTotals" />
     
                 <classpath refid="classpath_jars">
                 </classpath>
             </xslt>
            <echo message="XSLT report generated"/>
         </target>
        <!-- ====== Fetch the generated report's index.html, open a chrome browser and show the report.========= -->
         <target name="runAndViewReport" depends="run, testng-xslt-report">
                <exec executable="${browser}" spawn="yes">
               <arg line="'${basedir}/ReportFiles/MFP_AutomationReport.html'" />
              </exec>
            <echo message="Opening up the report in a browser..."/>
         </target>
</project>

Steps followed:-
1. ant compile------>Successful
2. ant run---->Successful
3. ant testng-xslt-report---->Failed

Facing below issue on running "ant testng-xslt-report"
build.xml:82: Reference classpath_jars not found.

The line number 82 refers to below line in build.xml file.

            <xslt in="${basedir}/test-output/testng-results.xml" style="${basedir}/configurations/testng-results.xsl" out="${basedir}/ReportFiles/MFP_AutomationReport.html">

Any suggestion/inputs would be appreciated...

Thanks&Regards,
Matti

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/a4be26f2-5951-42fb-99f4-b7a10680ddbd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Sudheer Qa

unread,
May 26, 2015, 5:02:16 AM5/26/15
to seleniu...@googlegroups.com
The resolution for this issue is explained clearly in this blogger. 

Please have a look at it.. 

http://tobeanexpert.blogspot.in/2015/05/generate-xslt-report-ant-buildxml.html

I hope this will helps you.. 

Thanks, 
sudheer.
To post to this group, send email to seleni...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages