daily pastebin goal
86%
SHARE
TWEET

Untitled

a guest Jun 21st, 2015 251 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <project name="Automation" default="sendMail" basedir=".">
  2.  
  3.    <!-- Defining property  -->
  4.  
  5.     <property name="project.dir" value="${basedir}"/>
  6.     <property name="build.dir" value="${basedir}/build"/>
  7.     <property name="jar.dir" value="${basedir}/lib
  8.     <property name="src.dir" value="${basedir}/src"/>
  9.     <property name="ng.result" value="test-output"/>
  10.  
  11.      <!-- Setting Classpath for jar files -->  
  12.     <target name="setClassPath">
  13.         <path id="classpath_jars">
  14.             <pathelement path="${basedir}/" />
  15.             <fileset dir="${jar.dir}">
  16.                 <include name="*.jar"/>
  17.                 </fileset>
  18.         </path>
  19.         <pathconvert pathsep=":" property="test.classpath" refid="classpath_jars" />
  20.     </target>
  21.  
  22.  
  23.       <!-- Loading Testng   -->
  24.  
  25.     <target name="loadTestNG" depends="setClassPath" >
  26.         <taskdef resource="testngtasks" classpath="${test.classpath}"/>
  27.     </target>
  28.  
  29.       <!-- Deleting directories  -->
  30.      <target name="clean">
  31.         <echo message="deleting existing build directory"/>
  32.         <delete dir="${build.dir}"/>
  33.     </target>
  34.       <!-- Creating build folder to store compiled classes  -->
  35.     <target name="init" depends="clean,setClassPath">
  36.         <mkdir dir="${build.dir}"/>
  37.     </target>
  38.           <!-- Compiling java files -->
  39.     <target name="compile" depends="clean,init,setClassPath,loadTestNG">
  40.         <echo message=""/>
  41.         <echo message="compiling.........."/>
  42.         <javac
  43.             destdir="${build.dir}"
  44.             srcdir="${src.dir}"
  45.             includeantruntime="false"
  46.             classpath="${test.classpath}"/>
  47.     </target>
  48.  
  49.  
  50.     <target name="run" depends="compile">
  51.         <testng classpath="${test.classpath}:${build.dir}">
  52.             <xmlfileset dir="${basedir}" includes="testng.xml"/>
  53.         </testng>
  54.     </target>
  55.  
  56.     <target name="create_directory_with_timestamp">
  57.  
  58.    <!-- Declare the timestamp format of DAY_TIME_NOW -->
  59.    <tstamp><format property="DAY_TIME_NOW" pattern="yyyy-MM-dd_HH.mm.ss" /></tstamp>
  60.  
  61.    <!-- Using DAY_TIME_NOW to create a directory called DAY_TIME_NOW -->
  62.    <mkdir dir="${basedir}/${DAY_TIME_NOW}"/>
  63.  
  64.    <move todir="${basedir}/${DAY_TIME_NOW}">
  65.     <fileset dir="${project.dir}/XSLT_Reports/output">
  66.       <include name="**/*.*"/>
  67.           </fileset>
  68.   </move>
  69.  
  70.  </target>
  71.  
  72.  
  73.       <!-- adding XSLT report target to produce XSLT report  -->
  74.     <target name="makexsltreports" depends="run,create_directory_with_timestamp">
  75.         <delete dir="${project.dir}/XSLT_Reports/output">
  76.         </delete>
  77.                   <mkdir dir="${project.dir}/XSLT_Reports/output"/>
  78.  
  79.        <xslt in="${ng.result}/testng-results.xml" style="src/dummy/testng-results.xsl"
  80.                        out="${project.dir}/XSLT_Reports/output/index.html"                classpathref="classpath_jars" processor="SaxonLiaison">
  81.                       <param name="testNgXslt.outputDir" expression="${project.dir}/XSLT_Reports/output/"/>
  82.        <param name="testNgXslt.showRuntimeTotals" expression="true"/>
  83.         <param expression="true" name="testNgXslt.sortTestCaseLinks" />
  84.      <param expression="FAIL,SKIP,PASS,CONF,BY_CLASS" name="testNgXslt.testDetailsFilter" />
  85.                   </xslt>
  86.               </target>
  87.  
  88.  
  89.  
  90.       <!-- using javax.mail.jar and javax.activation.jar trying to send report as zip file  -->
  91.  
  92.      <target name="sendMail" depends="makexsltreports">
  93.         <zip destfile="${project.dir}/XSLT_Reports/output.zip" basedir="${project.dir}/XSLT_Reports/output" />
  94.  
  95.         <mail
  96.              tolist="tarakesh.potluri@fmr.com"
  97.     from="tarakesh.potluri@fmr.com"
  98.     cclist= "qatestinghome@gmail.com"
  99.     subject="Email subject"
  100.     mailhost="smtp.gmail.com"
  101.     mailport="465"
  102.     ssl="true"
  103.     user="tarakesh.potluri@fmr.com"
  104.     password="Maestro47">
  105.                  <attachments>
  106. <fileset dir="${project.dir}/XSLT_Reports/">
  107. <include name="**/*.zip"/>
  108. </fileset>
  109. </attachments>
  110.  
  111.         </mail>
  112.     </target>
  113.  
  114.  
  115. </project>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top