Issue
I am using jenkins pipeline, does junit command once executed during build, stores the test results even after deleting the junit reports directory? If yes, where does Jenkins reads the deleted junit reports?
Solution
Jenkins does archive the JUnit test reports. So after your pipeline finishes (e.g. on an ephemeral agent), you'll still be able to access those reports. The same is true if you remove the report folder after you captured them with the plugin.
You can tell the JUnit plugin where to find your .xml
Surefire/Failsafe reports. In a declarative pipeline, this can look like the following:
post {
always {
junit '**/target/surefire-reports/*.xml'
}
}
The source code of this plugin is available on GitHub, so you can take a look at how it's achieved under the hood.
Answered By - rieckpil