Friday, 21 November 2014

Email Zipped Reports in Selenium Webdriver using ANT



Email Zipped Reports in Selenium Webdriver using ANT

 1.       For generating ANT Reports refer link

 2.       For Generating Zipped reports using ANT build.xml refer link

 3.       Add javax.mail.jar.zipand javax.activation.jar.zip to your ${ANT_HOME} lib folder.

 4.        Also add Javax.mail and Javax.activate jar in class path of Ant. Go to Window–> Preferences –> Ant (Click on triangle icon to expend Ant options) –> Click on Runtime –> Select Classpath tab –> select Global Entries –> Click on Add external jar and add above mentioned jar and click ok and then select the build.xml and run as you are trying to run your program and it will work..

 5.       For emailing the reports, add the following code to build.xml

 <target name="sendMail" depends="junitreport,addZip">
                      <mail mailhost="smtp.gmail.com" mailport="465" user="archana@gmail.com"
                          password="abc123" ssl="on" messagemimetype="text/html"
                          charset="ISO-8859-1" subject="Test Results"
                          tolist="archana@gmail.com">
                          <from address="archana@gmail.com"/>
                          <message>
                              Please view index.html page for report in attached zip.
                          </message>
                          <fileset dir="${zip}"/>
                      </mail>
                      <echo> Mail is sent successfully </echo>
                  </target> 
     
 6.       Copy paste the above code and replace your email id and password.

 7.       The ${ZIP} folder is the path where your zip file is generated.

No comments:

Post a Comment