I am using gradle with the Java plugin.
Is there a way to delete outdated test outputs when rerunning the tests? (In the folders testReportsDir and testResultsDir)
I see the following possible solutions but I don’t know how to configure it:
- Before running the tests delete all test outputs.
- After running the tests delete outdated test output files.
Background:
I only wan’t to rerun the testcases when the inputs/outputs have changed.
Although when rerunning the tests I want to clear the report so that there is no old reports laying around.
Example: If I rename/delete an TestClass123 the testResultsDir would still contain an old xml with the results of the deleted/renamed testclass.
as a workaround you can delete the testresultsDir in a doFirst block: