Getting Cobertura reports for pax-exam Integration Tests - osgi

I am running my Integration Tests using maven and the failsafe plugin. The tests themselves are executed using pax-exam (which uses pax-runner). Failsafe runs at the integration-test phase, and Cobertura at verify.
While I get reports for all my junit tests, I get nothing from the Integration Tests.
Is this even technically feasible, or would pax-runner need to support cobertura directly?
Any idea how I could solve this? I am also open to any other plugin that helps, but I do need to run integration tests on OSGi bundles..
Thanks!

Well, it's been a while. The closest thing I've found that could help out is instrumenting the builds and collecting cobertura.ser files after the pax-exam tests have run. It is far from a simple setup. I'll report as I go! relevant reference

Related

Dropwizard, testing a fat jar

Hey I am really desperate. I want to build a fat jar with Dropwizard (and Maven) but I realize the shade plugin won't include test classes so no tests are running.
Is there an easy way to run those tests with a "clean install" goal. I can't believe dropwizard 's getting started page tells you to use this shade plugin if it has tests problems.
Please help me!!
I am really sorry, I panic big time and the bug was because of another thing. The Surefire plugin has a bug in a particular version and when I ran it in a docker container the tests weren't recognized. SORRY

Is there any way to get the code coverage of a Concordion tests?

I have a Java Project with Concordian and Maven, and I would like to know if is there a way to get the code coverage of a Concordion tests?
take a look at Jacoco. It has a Maven plugin and can run locally or remotely.

Manage multiple Surefire ReportPaths with Sonarqube/Jenkins

In my company we develope eclipse plugins continuously built by a Jenkins CI Server (with tycho & maven) which also executes the tests (Unit Tests and SWTBot Tests). As a post build action we send the test data (JaCoCo & Surefire reports) via maven to a SonarQube server for analysis. Our sources and tests are each located in an own module.
In src/com.mycompany.projectA/ we have the source from Project A.
In test/com.mycompany.projectA.tests.ut/ we have the unit tests from Project A.
In test/com.mycompany.projectA.tests.swtbot/ we have the swtbot tests from Project A.
In order to allow Sonar to find the Jacoco and Surefire reports for the tests of each source plugin we set the report paths in our pom.xml:
<sonar.jacoco.reportPath>${project.basedir}/../../test/${project.artifactId}.tests.ut/target/jacoco.exec</sonar.jacoco.reportPath>
<sonar.surefire.reportsPath>${project.basedir}/../../test/${project.artifactId}.tests.ut/target/surefire-reports</sonar.surefire.reportsPath>
But this only allows one test per plugin. To also see the SwtBot test coverage in SonarQube, we added the SWTBot tests as integration tests (yeah I know, not very neat...)
<sonar.jacoco.itReportPath>${project.basedir}/../../test/${project.artifactId}.tests.swtbot/target/jacoco.exec</sonar.jacoco.itReportPath>
Like this, we can at least see the unit test coverage as well as the SWTBot test coverage in SonarQube. But as we are only able to set one report path for the surefire reports, those are ignored by Sonar and we can not see how many SWTBot test passed/failed.
Is there a convenient way to add multiple locations of surefire reports to be considered in the analysis?
This is not possible yet, but there's a ticket open for that: https://jira.codehaus.org/browse/SONAR-4101
Feel free to watch it and vote for it.
Maybe you can append the jacoco.exec of each project together and put the integrated jacoco report to Sonar. The following link is a good example to integrate the jacoco report.
http://www.lordofthejars.com/2012/07/jacoco-in-maven-multi-module-projects.html

Benefits of Maven FailSafe Plugin

I read Maven Failsafe plugin is designed specifically to run integration tests. Currently I'm working on a multi-module project and integration tests are in its own separate module, written in TestNg and run using Surefire plugin. We don't have conflicts with unit tests since only integration tests are run in the test phase in that module. And to set up the environment before the tests, and clean it after tests are run, #BeforeSuite #AfterSuite TestNg annotations are used. So there's no need to make use of pre-integration-test phase, integration-test phase, post-integration-test phase utilized by Failsafe plugin.
Are there any more benefits I'm missing out on, by not using the Failsafe plugin?
Are there better ways to do my current requirement using Failsafe plugin?
Can I do my server startup, shut down, file unzipping etc. in the pre-integration-test, post-integration-test phases without writing a maven plugin?
If you already have your own test setup/teardown in your suites, which from the looks of it you do, there is not much you can gain from the FailSafe plugin.
The FailSafe plugin is useful in situations where the Setup of your System Under Test is costly or takes a long time such as starting up a Servlet or a distributed system. The way the FailSafe plugin comes handy in these situations is that you can set up this environment in the pre-integration-test phase. This plugin also doesn't stop the execution of the Maven build when a test fails, which allows you to clean up all of your artifacts during the post-integration-test phase, after which it checks the status of your tests and passes or fails the build accordingly during the verify phase.
Failsafe has one big feature vs Surefire: When a test fails, it does not immediately abort. Instead it lets the clean-up code run (which typically takes down the Jetty server).
Addressing your third question as it isn't really answered, imho.
Can I do my server startup, shut down, file unzipping etc. in the pre-integration-test, post-integration-test phases without writing a maven plugin?
Taken from this answer to "Maven Failsafe Plugin: how to use the pre- and post-integration-test phases"
It boils down to: pre-integration-test and post-integration-test do nothing per default. You can bind a plugin specific for your task to those phases. Finding a specific plugin depends on what you're trying to do.
Another important thing to point out is default naming conventions used by the maven-failsafe-plugin: It runs test-classes with names starting or ending with IT (as integration test class)

integrating soapUI report into sonar

I have the following setup. I use maven /soapUI maven plugin /soapUI to execute tests on a webservice. My target is to display the test results in sonar. As there is no real build going on in maven, there is nothing to analyze for sonar (if i understood that correct). Is there a a soapUI report format, that can be reused by sonar? Has anyone made experiences with such a setup?
Thanks.
Why not try and run soapui from Junit?
http://www.soapui.org/Test-Automation/integrating-with-junit.html
Maven will run them automatically as part of the build and Sonar should display the results normally.

Resources