hudson cobertura reporting 0 - maven-2

I have a problem that when I run the cobertura target maven, the report always shows 0%.I've tried forking my junit tests, and no luck. I've tried configuring the cobertura plugin in the reporting section and build section of the pom, and also tried binding it to both the site and package phase. Any thoughts?
On a related note, I've also noticed that running the tests in Cobertura within hudson causes the junit plugin to report that each test was run twice (which doubles the number of tests reported as run). Any way around this?
thanks,
Jeff

There is a compatibility issue with JDK 1.6.0_14 and the cobertura plugin. And the plugin also has problems with multithreaded tests. The 0% problem was fixed by used b7 of JDK6, and maybe a fix will come out for the multithreading soon (there is a patch available)

I think it would be helpful to post whatever part of the pom.xml you define your Cobertura plugin and where in your profile you actually use it. Could you provide this so it provides some context for someone to look at? While I'm sure that copying/pasting [http://mojo.codehaus.org/cobertura-maven-plugin/usage.html] wouldn't help any of us out, perhaps providing your < include> and < excludes> can help out.

Related

Is there a way to run Karate tests as an integration test suite against a pre-booted spring boot server?

Is there any good way to get Karate tests to test a Spring-Boot microservice in the "integration-test" phase of a Maven build? What I mean is: is there an anti-pattern/workaround that works well OR am I out of luck because this was an afterthought of the Karate development?
Facts I have gathered so far:
It says here: "the surefire plugin is not hardcoded into Karate"
Is there a way to run Karate test during maven's integration test phase?
Running Karate tests in context of maven-failsafe-plugin does not work at all. Easy to reproduce on my test project url below. Two problems foremost:
When running from maven-failsafe, Karate will generate .txt and .html files but does not generate .json Cucumber output files.
Therefore, you can get no HTML report from the cucumber-reporting plugin (which I require)
I created a project to demonstrate these facts: https://github.com/djangofan/karate-api-sample
Running integration tests requires that I start Spring Boot before the test suite and then stop the spring boot server afterwards. Maven SureFire does not have this capability BUT the maven failsafe plugin does: the maven build helper plugin has a pre-integration-test hook for it. Limited only by Maven surefire, I am out of luck.
I see an example in the karate/karate-demo project of starting the spring boot server from code. This is not easy to accomplish when I am trying to test a web service that is already established. Is this my only option: to use surefire with a class filter and code to bootstrap?
Given no good answer, I will just revert to using cucumber-java + resteasy, which I am pretty sure will work with maven failsafe: https://maven.apache.org/surefire/maven-failsafe-plugin/examples/cucumber.html
First, this is not Karate.js not sure where that came from :)
When running from maven-failsafe, Karate will generate .txt and .html files but does not generate .json Cucumber output files.
Sorry, cannot replicate.
For failsafe, just use the naming conventions and it will work, e.g. **/IT*.java
Maven SureFire does not have this capability BUT the maven failsafe plugin does:
So use failsafe as mentioned above. If you are not able to do that, please change your project to demonstrate the issue and we promise to fix it. Also refer these instructions: https://github.com/intuit/karate/wiki/How-to-Submit-an-Issue
Given no good answer, I will just revert to using cucumber-java + resteasy
That is of course your choice. At least in my (biased :) opinion you will miss all the JSON assertion value that Karate adds, and the parallel execution + aggregation of reports. I am sure you will help as far as possible so that we can make the experience better for all who need this solution - but else, hey - no worries :P

Intellij complains about fork mode when running tests with code cover

I want to get information about how much the tests cover in our application. When I try to run all tests with coverage Intellij complains about the current fork mode. See image below.
The strange thing is that in the selected Run/Debug Configuration that I have the Fork mode is already set to none. Intellij still encourage me to change the Fork mode to none.
I am using Intellij 13.0.1, this is a feature that have been around for long, so I am missing something obvious, right?
Does anyone know what the problem might be?
IDEA-118572 unable to run JUnit tests with code coverage - fork mode is required

Automatically start jetty when running acceptance tests from IntelliJ IDEA

I have a bunch of acceptance tests that need the application to be running. It all works fine when I test from command line (thanks to some gradle magic) but I would like to be able to run these tests from IntelliJ IDEA without worrying about starting up Jetty.
Is there any clever way to achieve that automation? I do not even know where to begin.
Thank you very much.
You can do it with Maven/Ant, other Run configurations, but not Gradle at the moment, at least until this feature request is implemented.
For testing purposes it's generally a good idea to use jetty embedded. That way you can fully automate start/stop of jetty and it will work completely independent from build tools/ide.
It's really simple. With few lines of code you have a full featured jetty configured and running for testing.
This is one of the most beloved features of jetty. Have a look at this:
http://www.eclipse.org/jetty/documentation/current/advanced-embedding.html

Scala build tool and test framework that play nice together?

Here are my goals:
1. Run my tests in Eclipse and see the pretty green or red bar.
2. Run my tests on the command line with a build tool.
I'm leaning towards specs and sbt, but I can't get them to work. I have no desire to pick up Maven. My question is which one of the follow sets works best?
sbt and scalatest
sbt and specs
ant and scalatest
ant and specs
something else?
A consideration is how much effort do other people need to get the project up and running on a new machine. Bonus points if it can integrate with Hudson.
SBT is definitely the way to go over ant. Ant will not give you congruency with maven project structures and would force you to roll your own dependency management.
Either scalatest or specs will work. The former seems to be a de facto, but I get excellent results with specs.
I am not an Eclipse user, but would be surprised if either test library was not supported.
I'm currently switching the specs project to sbt and fixing a few things with Mark Harrah (check out the sbt mailing list for the details).
Please post any issues you may have with specs and sbt and I'll try to fix them ASAP.
Thanks,
Eric.

Use maven2 for build-automation and continuous integration of an eclipse rcp project?

My company starts a new project next week. We have planned to develop the application with eclipse rcp. The build process should be fully automated, so we're prepared to set up a continuous integration environment (e.g. Continuum). For the build-automation-part I intended to use maven2, because I want use its dependency management.
I have used maven2 for a small old-style java project, but have never set up maven for using it with eclipse rcp.
What's the best way to do this? Basic concepts? Common traps? Are any tutorials or book's around there? The tutorials and informations I found, seemed outdated or incomplete.
PS: The main project will be divided into sub-project's (plug-in's). But I think this is typical for eclipse rcp projects.
You should take a look at Tycho:
the-future-of-maven-osgi-join-the-tycho-users-mailing-list
the-next-generation-of-build-tools-for-eclipse-plugins-and-rcp-applications
Like most Maven questions, this is solved by a link to a plug-in:
"pde-maven-plugin"
Other advice:
use the assembly plug-in to build
the update site
consider using hudson rather than
Continuum
I've been battling maven2/Eclipse RCP integration for some time. The key is not so much getting your setup right: You can get it to work - eventually - by reverse-engineering Eclipse's build process in maven.
In my experience, the hard part is keeping everything up to date. Every time Eclipse revs their libs, you'll find yourself re-writing a bunch of pom files for that newest RCP widget or SWT lib. Naturally, CI helps with this somewhat. The problem is that Eclipse and maven are very particular about the way they do the business of building, and their approaches are quite different. To make matters worse, PDE dev (and Eclipse dev, more generally) is powered by a lot of wizard code, which is sometimes quite opaque as to what's happening behind the scenes.
The question you really need to ask yourself is if it's worth the effort. In my particular case, I believe it has been. (CI is too good to live without.) But the trade-off is that you may find yourself being the "build guy", which can take valuable time away from actual development, which is probably what you enjoy most.
I've got recently the same problem : build eclipse RCP application through continuous integration.
I haven't applied them yet but I've found some interesting articles :
Here's the documentation for Tycho
Building Eclipse Plugins with Maven 2 on eclipse.org
Build Eclipse RCP products using Maven 2 - how hard can it be? from Immo Hüneke's blog
Here's an article about PDE build automation
Here's a shell script to automate JUnit test launch