Sunday, 17 May 2015

How to copy Emailable_Report for each instance in TestNg Framework



If we need to copy and paste for each instance then we need to add below code in our framework

We should add this code in @AfterTest Annotation section

 @AfterTest
  public void aftertest() throws IOException
  {
 driver1.close();
 Date dat1=new Date();
 SimpleDateFormat sdf=new SimpleDateFormat("ddMMyyy'_'hh.mm.ss");
 File Source1= new File(System.getProperty("user.dir")+"\\test-output\\emailable-report.html");
 String str=sdf.format(dat1);
 File Destination=new File(System.getProperty("user.dir")+"\\emailable-report_"+str+".html");
 FileUtils.copyFile(Source1, Destination);
 System.out.println(sdf.format(dat1));

  }

No comments:

Post a Comment