When I followed this link LINK to generate XSLT Report Using testng and to send email reports getting error message (Ex: package org.openqa.seleni um does not exist, etc...0).
Please suggest me.
build.xml code is:
<project name="XSLT" default="sendMail" basedir=".">
<!-- Defining property -->
<property name="project.dir" value="${basedir}"/>
<property name="build.dir" value="${basedir}/build"/>
<property name="jar.dir" value="${basedir}/Lib"/>
<property name="src.dir" value="${basedir}/src"/>
<property name="ng.result" value="test-output"/>
<!-- Setting Classpath for jar files -->
<target name="setClassPath">
<path id="classpath_jars">
<pathelement path="${basedir}/" />
<fileset dir="${jar.dir}">
<include name="*.jar"/>
</fileset>
</path>
<pathconvert pathsep=":" property="test.classpath" refid="classpath_jars" />
</target>
<!-- Loading Testng
<target name="loadTestNG" depends="setClassPath" >
<taskdef resource="testngtasks" classpath="${test.classpath}"/>
</target> -->
<!-- Deleting directories -->
<target name="clean">
<echo message="deleting existing build directory"/>
<delete dir="${build.dir}"/>
</target>
<!-- Creating build folder to store compiled classes -->
<target name="init" depends="clean,setClassPath">
<mkdir dir="${build.dir}"/>
</target>
<!-- Compiling java files -->
<target name="compile" depends="clean,init,setClassPath">
<echo message=""/>
<echo message="compiling………."/>
<javac
destdir="${build.dir}"
srcdir="${src.dir}"
includeantruntime="false"
classpath="${test.classpath}"/>
</target>
<target name="run" depends="compile">
<testng classpath="${test.classpath}:${build.dir}">
<xmlfileset dir="${basedir}" includes="testng.xml"/>
</testng>
</target>
<!-- adding XSLT report target to produce XSLT report -->
<target name="makexsltreports" depends="run">
<delete dir="${project.dir}/XSLT_Reports/output">
</delete>
<mkdir dir="${project.dir}/XSLT_Reports/output"/>
<xslt in="${ng.result}/testng-results.xml" style="/MFW/XSLT/testng-results.xsl" out="${project.dir}/XSLT_Reports/output/index.html" classpathref="classpath_jars" processor="SaxonLiaison">
<param name="testNgXslt.outputDir" expression="${project.dir}/XSLT_Reports/output/"/><param name="testNgXslt.showRuntimeTotals" expression="true"/>
<param expression="true" name="testNgXslt.sortTestCaseLinks" />
<param expression="FAIL,SKIP,PASS,CONF,BY_CLASS" name="testNgXslt.testDetailsFilter" />
</xslt>
</target>
<!-- using javax.mail.jar and javax.activation.jar trying to send report as zip file -->
<target name="sendMail" depends="makexsltreports">
<zip destfile="${project.dir}/XSLT_Reports/output.zip" basedir="${project.dir}/XSLT_Reports/output" />
<mail
tolist="[email protected]"
from="[email protected]"
subject="Email subject"
mailhost="smtp.gmail.com"
mailport="465"
ssl = "true"
user="[email protected]"
password="123456">
<attachments>
<fileset dir="${project.dir}/XSLT_Reports/">
<include name="**/*.zip"/>
</fileset>
</attachments>
</mail>
</target>
</project>
Error:
D:\MFW\XSLT>ant makexsltreports
Buildfile: D:\MFW\XSLT\build.xml
clean:
[echo] deleting existing build directory
[delete] Deleting directory D:\MFW\XSLT\build
setClassPath:
init:
[mkdir] Created dir: D:\MFW\XSLT\build
compile:
[echo]
[echo] compilingààà.
[javac] Compiling 1 source file to D:\MFW\XSLT\build
[javac] D:\MFW\XSLT\src\spk\Testing.java:3: error: package org.openqa.seleni
um does not exist
[javac] import org.openqa.selenium.WebDriver;
[javac] ^
[javac] D:\MFW\XSLT\src\spk\Testing.java:4: error: package org.openqa.seleni
um.firefox does not exist
[javac] import org.openqa.selenium.firefox.FirefoxDriver;
[javac] ^
[javac] D:\MFW\XSLT\src\spk\Testing.java:5: error: package org.testng.annota
tions does not exist
[javac] import org.testng.annotations.Test;
[javac] ^
[javac] D:\MFW\XSLT\src\spk\Testing.java:9: error: cannot find symbol
[javac] @Test
[javac] ^
[javac] symbol: class Test
[javac] location: class Testing
[javac] D:\MFW\XSLT\src\spk\Testing.java:11: error: cannot find symbol
[javac] WebDriver d = new FirefoxDriver();
[javac] ^
[javac] symbol: class WebDriver
[javac] location: class Testing
[javac] D:\MFW\XSLT\src\spk\Testing.java:11: error: cannot find symbol
[javac] WebDriver d = new FirefoxDriver();
[javac] ^
[javac] symbol: class FirefoxDriver
[javac] location: class Testing
[javac] 6 errors
BUILD FAILED
D:\MFW\XSLT\build.xml:47: Compile failed; see the compiler error output for deta
ils.
Total time: 1 second
Folder Structure:
Code:
package spk;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.Test;
public class Testing {
@Test
public void test() {
WebDriver driver = new FirefoxDriver();
driver.get("http://google.co.in");
driver.quit();
}
}