Is it possible to change the report name to include the timestamp on Android instrumented tests? I couldnt' find any documentation on this nor do i know where to begin investigating to be completely honest.
you can change the report name for Android instrumented tests to include a timestamp. It’s not too complicated, just requires a little setup.
You can create your own test runner by extending AndroidJUnitRunner. This will allow you to override methods responsible for report generation and add logic to modify the filename.
There are libraries like android-junit-report that can help with report generation. They allow you to customize filenames and paths.
sample
public class CustomTestRunner extends AndroidJUnitRunner {
@Override
public void onCreate(Bundle arguments) {
super.onCreate(arguments);
String timestamp = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.getDefault()).format(new Date());
String reportName = "test_report_" + timestamp + ".xml";
// Logic to save the report with the new name
}
}