Saturday, September 20, 2014

Archive Test Reports

Archive test reports using the following snippet. Have this in AfterTest or AfterClass, depends on your requirement 

//        It archives test reports  - author @k.s.karthikeyan@gmail.com
package mslt.verification;

import java.io.File;
import java.io.IOException;

import org.apache.maven.wagon.util.FileUtils;
import org.testng.annotations.Test;

public class ArchiveReport  {

    @Test
      public void archiveTestReport() throws IOException {
            File source = new File(System.getProperty("user.dir")+"/test-output/emailable-report.html");
            File destination = new File("/Users/admin/Desktop/emailable-report_"+System.currentTimeMillis()+".html");
            FileUtils.copyFile(source, destination);
            System.out.println("Report copied to the path "+destination);
    }
}

No comments:

Post a Comment