spock and clover integration - maven

In my project, we are using spock for unit testing. I want to configure spock test cases with clover so that it can generate the coverage report. I have followed steps and configure it in maven. However, I am not able to configure it properly.
Could anyone guide me, to configure clover with spock?
my groovy test cases are in src/test/groovy package.
Thanks,
Jay Patel

Could anyone guide me, to configure Clover with Spock?
What problem exactly do you have? I'm asking, because tests written in Spock are no different from tests written in any other framework. As long as you build these classes with Clover and execute tests, you shall be able to get code coverage reports.
Please also note that Clover introduced a dedicated support for Spock's test iterations in version 3.3.0. So make sure you're using the latest version of Clover. I suggest Atlassian Clover 4.1.2 (the last version released by Atlassian) or OpenClover 4.2.0 (released by community).

Related

How do I get SonarQube to count spock/groovy unit tests?

I am trying to configure SonarQube to report an accurate count of the unit test cases in my repository, currently it is only showing the java jUnit test cases.
SonarQube reports the java jUnit test count as well as the overall coverage from jacoco which includes both java and groovy coverage.
How do I get SonarQube to recognize the groovy/spock unit tests in the overall count?
SonarQube 7.7 (I see the issue on 7.4 as well)
I am not sure if there is a specific sonar property I need to set in my Gradle configuration or if there is a plugin in SonarQube itself I need to install?
I do see some related answers about installing the Groovy plugin in SonarQube however there is no mention as to which version of SonarQube this is a solution for (I no longer see this plugin as available)
The marketplace had been missing the Groovy plugin for quite some time. A new version has just been released!
Simply installing the plugin that is available on the Marketplace solved this problem.
https://github.com/pmayweg/sonar-groovy

How to exclude packages in sonar only for coverage but not for CheckStyle?

I want to exclude some packages only for Emma coverage from sonar report. I have tried like below -Dsonar.coverage.exclusions=ab/cyz/data/perftracking/dao/*
in Jenkins job configuration, It was not working for me. I am using sonar version 3.4.1, Emma Plug in version 1.3.
-Dsonar.exclusions=ab/cyz/data/perftracking/dao/* is working as expected but it is excluding packages from all sonar metrics.
Is there any way to exclude packages from Emma coverage.
Please help on this.
Thanks you:)
This is not the advice you were looking for, but that is a very old version of the platform, and Emma is deprecated - at least for Java. I suggest you start by upgrading your platform and switching to JaCoCo. Your exclusions should work then.

How to setup the maven project to run the JMeter tests?

I am trying to setup the maven project to run the JMeter tests. Please let me know the way to setup the things to run the JMeter tests using Maven.
For me, most natural option is to use jmeter-maven-plugin:
https://github.com/jmeter-maven-plugin/jmeter-maven-plugin
It has good wiki with plenty of configuration examples.
I documented it all here. This project describes how to do it with Gradle and also with Maven. Personally, I think the Gradle version is a little more stable but the Maven version allows for nice HTML reports.

Is it necessary to have Maven and Junit or TestNG to run sauce labs for mobile testing

We have a custom framework built for Selenium with Java and we do not use Junit or TestNG and Maven. We are using to ant build our project. So I wanted to understand is it necessary to have Maven and Junit or TestNG to run sauce labs for mobile testing? We are planning to include Appium in our framework and would like explore way for executing our test on sauce lab.
If there are any alternate option we have then please point me to them.
Thanks,
Raghav
So, since you are using Ant, then the answer is No you do not need maven. Both Ant and Maven are project dependency management tools.
As far as the testing framework goes, you don't have to use any of them, but the reason you would want to use them, is for Pass/Fail recognition.
With a testing framework you can run each test individually and see a green pass, or red fail within your IDE. As well as suite management (See TestMethodRunner) It's possible that SauceLabs can detect these frameworks and detect failures as well, so I wouldn't see why you wouldn't use at least jUnit or TestNG.

Getting Cobertura reports for pax-exam Integration Tests

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

Resources