-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.xml
79 lines (67 loc) · 2.91 KB
/
build.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<project name="SampleAppiumProject" default="sendMail" basedir=".">
<!-- Defining property -->
<property name="project.dir" value="${basedir}"/>
<property name="build.dir" value="${basedir}/build"/>
<property name="jar.dir" value="D:/Jars"/>
<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="${jar.dir}/testng-6.8.21.jar"/>
</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,loadTestNG">
<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="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="pratik.barjatiya@talentica.com" from="pratik007b@gmail.com"
subject="Email subject" mailhost="smtp.gmail.com" encoding="mime" charset="ISO-8859-1"
mailport="465" SSL="true" user="pratik007b@gmail.com" password="Pratik123$">
<attachments>
<fileset dir="${project.dir}/XSLT_Reports/">
<include name="**/*.zip"/>
</fileset>
</attachments>
</mail>
</target>
</project>