Sunday 12 June 2016

ANT setup for xslt report using testNg in selenium

for xslt reprt user should have ANT with machine 

so 1st ANT installation we will see,

Step 1- Navigate to below mention url
step 2- Extract zip file
Step 3- Once we extract the zip file then we need to set environment variable
Step 4- ANT_HOME should get added in path
Step 5- Now verify that Ant is installed properly- Open CMD 
ant -version
Note- if it is install properly then in output console we will get build.xml not found-build failed
Step 5- add below build.xml to your project, from below url




<project name="TestAutomation" basedir=".">
    <property name="LIB" value="${basedir}/lib" />
    <property name="BIN" value="${basedir}/bin" />
    <path id="master-classpath">
        <pathelement location="${BIN}" />
        <fileset dir="${LIB}" includes="*.jar"/>
    </path>
    
    <target name="Report">
        <delete dir="${basedir}/testng-xslt">
        </delete>
        <mkdir dir="${basedir}/testng-xslt">
        </mkdir>
        <xslt in="${basedir}/test-output/testng-results.xml" style="${basedir}/testng-results.xsl" out="${basedir}/testng-xslt/index.html">
            <param expression="${basedir}/testng-xslt/" 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="master-classpath">
            </classpath>
        </xslt>
    </target>

</project>











Step 6- now again check Ant version, successful message will come
Step 7-Add saxon 2 jars for your reports to your project
Step 8- as per your build.xml, run command from cmd after coming to your project directory, ant Report(from build.xml)
Step 9- this will create xslt reoprt folder under YOUR PROJECT
STEP 10-For reports check index.html
Step 7- after this run your code, and get xslt reports with pass fail diagrams, for this TestNg should have install with you in eclipse


No comments:

Post a Comment