Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to integrate file backup(previous run results) utility in serenity framework? #1375

Closed
ganeshraja88 opened this issue Sep 13, 2018 · 0 comments
Labels

Comments

@ganeshraja88
Copy link

Hi John,
@wakaleo
I am trying to integrate the file backup utility with serenity frame
work and I don't know the steps to customize the framework. I have written the code and invoke that method before executing the story file. It has certain limitations like need to invoke this method in each story. But i would like to integrate with framework so that it can take the backup of previous run results regardless of story. If i want to execute all stories together then this file backup utility is duplicate. So please guide how to implement this utility with framework. Any kind of help is much appreciable! Thanks in advance.
filebackup.txt

package com.serenity.digital.steps;

import java.io.File;
import java.io.IOException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

import org.apache.commons.io.FileUtils;

public class fileBackup{

public void fileCopy() throws IOException {    
    
	
	Date now = new Date();
	SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd_HHmmss");
	String time = dateFormat.format(now);
	//System.out.println(dateFormat.format(now));
	String folderName = ("CustomerRegistrationNegative_"+time);    	
	String path = "P:/Execution_Archive/";
    File dir = new File(path+folderName);
    if (!dir.exists()) {
        if (dir.mkdir()) {
            System.out.println("Directory is created!");
        } else {
            System.out.println("Failed to create directory!");
        }
    
    File sourceLocation= new File("P:/wordspace_2/Digital/target/site/serenity");        
    File targetLocation = new File(""+dir);
    FileUtils.copyDirectory(sourceLocation, targetLocation);     
}

}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants