cobertura

SonarQube: Coverage on New Code never calculated

时光总嘲笑我的痴心妄想 提交于 2019-12-02 11:47:58
问题 I have set up SonarQube, Maven and Cobertura to upload unit test coverage at every build run. I want to use the differential views to get coverage for the delta (new code only). The coverage itself is successfully uploaded, and I can see the delta in lines of code. However, I can't get the "Coverage on new Code" to work. I tried different values for the leak period, including previous_analysis and previous_version (changing the version from 1.0 to 1.1 in the new analysis). I also used -Dsonar

SonarQube Analysis not showing code coverage

泄露秘密 提交于 2019-12-02 08:10:56
I have a Jenkins project to do SonarQube analysis of my NodeJS project. I added istanbul as a dependency to my project's package.json . In the Jenkins build configuration, first I run a shell script: cd ./project-name npm install node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha path-to-unit-tests node_modules/.bin/istanbul report cobertura cd .. This installs the dependencies, runs the tests and generates a code coverage report and generates a cobertura-coverage.xml file. After the shell script, I run a Invoke Standalone SonarQube Analysis with the following properties for code

SonarQube: Coverage on New Code never calculated

一个人想着一个人 提交于 2019-12-02 04:23:07
I have set up SonarQube, Maven and Cobertura to upload unit test coverage at every build run. I want to use the differential views to get coverage for the delta (new code only). The coverage itself is successfully uploaded, and I can see the delta in lines of code. However, I can't get the "Coverage on new Code" to work. I tried different values for the leak period, including previous_analysis and previous_version (changing the version from 1.0 to 1.1 in the new analysis). I also used -Dsonar.projectDate to simulate a past date of analysis but still no luck. Any thoughts? The key requirement

Should we unit test console outputs?

偶尔善良 提交于 2019-12-01 20:09:04
问题 I am working with some legacy code that has some System.out.print commands in itself. My eCobertura plugin shows this lines red, so I want to unit test them. Here in stackoverflow I found a way to unit test console outputs which i thing is very interesting. This is how I do it: private final ByteArrayOutputStream outContent = new ByteArrayOutputStream(); @Before public void setUpStreams() { System.setOut(new PrintStream(outContent)); } @After public void cleanUpStreams() { System.setOut(null)

Should we unit test console outputs?

匆匆过客 提交于 2019-12-01 19:19:10
I am working with some legacy code that has some System.out.print commands in itself. My eCobertura plugin shows this lines red, so I want to unit test them. Here in stackoverflow I found a way to unit test console outputs which i thing is very interesting. This is how I do it: private final ByteArrayOutputStream outContent = new ByteArrayOutputStream(); @Before public void setUpStreams() { System.setOut(new PrintStream(outContent)); } @After public void cleanUpStreams() { System.setOut(null); } @Test public void out() { System.out.print("Some message from the system"); assertEquals("Some

Cobertura doesn't work with Java 7

这一生的挚爱 提交于 2019-12-01 17:47:41
问题 I am using maven 3.0.4, JRE 1.7.0_09 . When I use mvn clean install all my tests passes and everything looks good - here is my surefire plugin configuration: <plugin> <version>2.12.4</version> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> <!-- -XX:-UseSplitVerifier is for java 7 --> <argLine>-XX:-UseSplitVerifier</argLine> </configuration> </plugin> Now, when I mvn cobertura:cobertura some of my tests have errors like this one:

SONAR importing cobertura.ser coverage reports to sonar server using mvn sonar:sonar?

若如初见. 提交于 2019-12-01 08:21:09
I have a cobertura.ser file, that got generated while integration-test and system test. Now I want to import my coverage this to sonar server. How can I achieve this, so while executing mvn sonar:sonar the coverage should consider external coberture.ser file? Can I do this using sonar, where i can see overall coverage obtain during all test run? You need to set the following paramater to tell Sonar to use a pre-generated report: sonar.dynamicAnalysis=reuseReports Secondly Sonar doesn't read the "cobertura.ser" file. It can be configured as follows to read the generated XML report (See

SONAR importing cobertura.ser coverage reports to sonar server using mvn sonar:sonar?

自作多情 提交于 2019-12-01 06:40:28
问题 I have a cobertura.ser file, that got generated while integration-test and system test. Now I want to import my coverage this to sonar server. How can I achieve this, so while executing mvn sonar:sonar the coverage should consider external coberture.ser file? Can I do this using sonar, where i can see overall coverage obtain during all test run? 回答1: You need to set the following paramater to tell Sonar to use a pre-generated report: sonar.dynamicAnalysis=reuseReports Secondly Sonar doesn't

Maven cobertura plugin - one report for multimodule project

眉间皱痕 提交于 2019-11-30 19:46:31
I'm using maven cobertura plugin to report code coverage in my multimodule project. The problem is that I don't know how to generate one report for all modules in project. So far I have generated separate reports for every module, but it would be nice to have one report for whole project. My parent pom configuration: <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>cobertura-maven-plugin</artifactId> <version>2.4</version> <inherited>true</inherited> <executions> <execution> <phase>test-compile</phase> <goals> <goal>clean</goal> <goal>cobertura</goal> </goals> </execution> <

How to get Cobertura to fail M2 build for low code coverage

£可爱£侵袭症+ 提交于 2019-11-30 13:13:31
I'm trying to configure my WAR project build to fail if the line or branch coverage is below given thresholds. I've been using the configuration provided on page 455 of the excellent book Java Power Tools , but with no success. Here's the relevant snippet of my project's Maven 2 POM: <build> ... <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>cobertura-maven-plugin</artifactId> <version>2.2</version> <configuration> <check> <!-- Per-class thresholds --> <lineRate>80</lineRate> <branchRate>80</branchRate> <!-- Project-wide thresholds --> <totalLineRate>90</totalLineRate>