Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cobertura tests not found #15

Open
headcrashing opened this issue Feb 4, 2013 · 7 comments
Open

cobertura tests not found #15

headcrashing opened this issue Feb 4, 2013 · 7 comments

Comments

@headcrashing
Copy link

It seems there is a bug either in the book, the game-of-life project, or Jenkins 1.500. As it is hard to track where the bug is caused for a Jenkins beginner, I am posting it here so you can decide.

When enabling cobertura publishing as described on page 37 of chapter 2, using the recommended default path found in both the book's screenshot and the Jenkins GUI (**/target/site/cobertura/coverage.xml), the result is that the cobertura tests works fine but Jenkins does not find the coverage.xml file.

I checked the workspace and actually the file is not there, but Maven says cobertura actually did process files:

[INFO] --- cobertura-maven-plugin:2.5.2:cobertura (default-cli) @ gameoflife-web ---
[INFO] Cobertura 1.9.4.1 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
Cobertura: Loaded information on 2 classes.
Report time: 191ms

[INFO] Cobertura Report generation was successful.
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] gameoflife ........................................ SUCCESS [10.518s]
[INFO] gameoflife-build .................................. SUCCESS [0.302s]
[INFO] gameoflife-core ................................... SUCCESS [1.909s]
[INFO] gameoflife-web .................................... SUCCESS [1.780s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 15.726s
[INFO] Finished at: Mon Feb 04 17:46:31 CET 2013
[INFO] Final Memory: 16M/39M
[INFO] ------------------------------------------------------------------------
Veröffentliche Javadocs
Zeichne Testergebnisse auf.
[Cobertura] Publishing Cobertura coverage report...
[Cobertura] No coverage results were found using the pattern '**/target/site/cobertura/coverage.xml' relative to '/usr/share/tomcat6/.jenkins/workspace/gameoflife-default'. Did you enter a pattern relative to the correct directory? Did you generate the XML report(s) for Cobertura?
Build step 'Veröffentliche die Cobertura Testabdeckung' changed build result to FAILURE
Finished: FAILURE

@doganov
Copy link

doganov commented May 3, 2013

I am having exactly the same problem. Inspecting the workspace shows that HTML is generated inside gameoflife-core/target/site/cobertura directory, but cobertura.xml is nowhere to be found.

@jallman112
Copy link

I'm having the same issue. There's no site directory in the top-most target directory in the project's workspace:

[Cobertura] Publishing Cobertura coverage report...
[Cobertura] No coverage results were found using the pattern '**/target/site/cobertura/coverage.xml' relative to 'C:\Program Files (x86)\Jenkins\workspace\gameoflife-default'.  Did you enter a pattern relative to the correct directory?  Did you generate the XML report(s) for Cobertura?
[Cobertura] Skipped cobertura reports.

@ivarley
Copy link

ivarley commented Oct 30, 2013

Huh. Several months later, same here. Anybody ever get past this?

@ivarley
Copy link

ivarley commented Oct 30, 2013

@wakaleo - this seems to be a consistent point of failure in chapter 2. I just spent 2 hours trying to get it to work, with no luck. I tried adding "-Pmetrics" to use the metrics profile, since it seems like you messed with that some about a year ago (wakaleo/game-of-life@66b95ca). But still no luck, and it leaves me with a non-functional build at the end of chapter 2. Any pointers? Thanks!

@bellc
Copy link

bellc commented Nov 7, 2013

There seem to be a couple of issues, with the details provided by the book and with the plugin.
Note in the configuration under "Publish Cobertura Coverage Report": Cobertura must be configured to generate XML reports for this plugin to function.
I added a format property to the build step and was able to produce the coverage.xml
cobertura:cobertura -Dcobertura.report.format=xml

However the report generated 0's across the board, so the build was recorded as unstable.
That's where I believe there's a plugin-specific issue, and as far as I've gotten. Let me know if anyone has any insight.

Side note:
In v1.8 of the plugin an option was added to mark build as unstable (or not at all) instead of failed when no coverage xml files are found. This allow the build to succeed and you to proceed, depending on whether you prefer to sort out the plugin issue or continue the exercises in the book.
The option was added in response to several bug reports:
(https://issues.jenkins-ci.org/browse/JENKINS-12640)
https://issues.jenkins-ci.org/browse/JENKINS-12857
https://issues.jenkins-ci.org/browse/JENKINS-6554

@fliden
Copy link

fliden commented Mar 9, 2015

Same problem here with 0's across the board.
Deleting the line

<skip>true</skip>

in the surefire plugin seems to fix it.

@CosetteN
Copy link

Making @bellc & @fliden's changes fixed this for me. Once I remembered to push the change to my pom.xml file to github.

Figured I'd share my bonehead moment in case it saves someone else the hour I just lost.

mellmo added a commit to mellmo/game-of-life that referenced this issue Aug 30, 2016
akshayssh added a commit to akshayssh/game-of-life that referenced this issue Oct 13, 2016
groverboy added a commit to groverboy/game-of-life that referenced this issue Feb 12, 2018
As per suggested config change on the issues page below, made explicit instead of deleted.
wakaleo/jenkins-the-definitive-guide-book#15 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants