If you are using selenium web driver with maven-surefire-plugin, you might be aware of the fact that test run report are overwritten with the latest report in \target\surefire-reports\html folder. If you would like to refer to the past run reports, you may end up writing code to copy reports into the folder you want. Today I would like to share with you a easy to achieving the same using copy-maven-plugin.

Please follow the below steps:

1) Open you pom.xml file

2) Add the following property tag
    <maven.build.timestamp.format>yyyy-MM-dd_HH-mm-ss </maven.build.timestamp.format>

3) Add the below lines under <plugins> tag.

                    <!-- ~~~~~~~~~~~~~~ -->
                    <!-- Copy directory -->
                    <!-- ~~~~~~~~~~~~~~ -->
                         <targetPath>${basedir}/your target path/rep_${maven.build.timestamp}</targetPath>

Thats it, you are done. Now after each and every test run, reports will be saved in the folder you want with time stamp appended.

Try this if you have not tried it yet. Happy testing...:-)