Manuel Jordan
Manuel Jordan

Reputation: 16311

Jenkins: how save the logging outputs saved through Gradle testing into Jenkins Build History

I am working with:

I am able to execute a Main java class through a Gradle task through Jenkins. Therefore I can execute a Job N times to work around JMX and for each Job execution I have the Build History where I am able to see the logging outputs from my business classes for each interaction.

Note the history saves each logging outputs for each Job's execution

The problem is with testing.

Through Jenkins I am able to execute a Job related with a Gradle Test command, such as: gradle test --tests. Here two behaviors:

Thus the Jenkins does not contain the logging outputs from my business classes. Therefore if I execute N times through my developing cycle the Test Job. I only am able to see the latest logging outputs only through the Gradle Test Reports, sadly Jenkins does not keep these logging outputs through Build History.

How resolve this? Some basic configuration or a plugin is need it?

Upvotes: 1

Views: 1630

Answers (2)

Eddú Meléndez
Eddú Meléndez

Reputation: 6549

In order to save junit reports in Jenkins, you can use JUnit Plugin

Individual reports are located at build/test-results/test/.xml*

If you are using Declarative Pipelines you can use the following script

junit 'build/test-results/test/*.xml'

Since you are pointing to build\reports\tests\test\index.html which is the gradle test report, you can also save that report using HTML Publisher Plugin

My suggestiong is to use JUnit Plugin for better integration.

Upvotes: 2

Raquel Guimarães
Raquel Guimarães

Reputation: 982

To save artifacts from your build you can use the archiveArtifacts pipeline command

It would look something like:

archiveArtifacts artifacts: 'build/reports/tests/test/*'

Upvotes: 2

Related Questions