EclEmma: Error while analyzing package fragment root - code-coverage

I downloaded EclEmma 2.3.3 from Eclipse Marketplace to my Kepler Service Release 2. I ran a JUnit test with the test coverage option, but am getting the following error:
Error while loading coverage session (code 5001).
Error while analyzing package fragment root java at F/xxx/target/test-classes (code 5007).
Error while analyzing XXXClass.class.
I am able to run maven build and test within Eclipse with the Maven plugin and can also run tests as JUnit tests. The XXXClass file is not related to the test I ran the coverage on.

Related

SonarQube : nUnit's results are not displayed

I'm using SonarQube and Jenkins. In Jenkins, I check the unit tests with nUnit and the coverage with opencover. The opencover's report is displayed in Sonar but the nunit's report is not. The Unit Tests count is not even displayed in the home page of the project.
Here is what I do :
Build my VisualStudio project with MSBuild
Run nunit and opencover with a batch command line
Run SonarQube scanner's analysis
Package the project
The Step 2's command line :
MKDIR "%WORKSPACE%\reports"
MKDIR "%WORKSPACE%\reports-history"
SET COV_PTH="D:\Programmes\opencover.4.5.3522"
SET TOOL_PATH="D:\Programmes\NUnit-2.6.4"
SET RPT_PATH="D:\Programmes\ReportGenerator"
copy src\Foo.Bar.Tests\app.config build\Foo.Bar.Tests.dll.config
%COV_PTH%\OpenCover.Console.exe "-filter:+[Foo.Bar*]* -[Foo.Bar.Tests]* -[Foo.Bar.Service]* -[Foo.Bar.Domain]* -[Foo.Bar.Dal]Foo.Bar.Dal.Dao.* -[Foo.Bar.Controller]Foo.Bar.Controller.*Comparer -[Foo.Bar.Controller]Foo.Bar.Controller.External.*" -register "-target:%TOOL_PATH%\bin\nunit-console.exe" -targetargs:"build\Foo.Bar.Tests.dll /noshadow /result=reports\TestResult.xml" -output:reports\opencovertests.xml
%RPT_PATH%\ReportGenerator.exe "-reports:reports\opencovertests.xml" "-targetdir:reports-ReportGenerator" "-historydir:reports-history"
The Step 3's parameters :
sonar.projectKey=FooBar
sonar.projectName=FooBar
sonar.projectVersion=%SVN_REVISION%
sonar.sources=src/Foo.Bar.Controller, src/Foo.Bar.Dal, src/Foo.Bar.Domain, src/Foo.Bar.Fichier, src/Foo.Bar.Generation, src/Foo.Bar.Reporting, src/Foo.Bar.Service, src/Foo.Bar.Web
sonar.binaries=Build/Foo.Bar.Controller.dll, Build/Foo.Bar.Dal.dll, Build/Foo.Bar.Domain.dll, Build/Foo.Bar.Service.dll, Build/Foo.Bar.Fichier.exe, Build/Foo.Bar.Generation.exe, Build/Foo.Bar.Reporting.exe
sonar.tests=src/Foo.Bar.Tests
sonar.cs.opencover.reportsPaths=reports/opencovertests.xml
sonar.cs.nunit.reportsPaths=reports/TestResult.xml
EDIT
I also tried the following process (same results) :
Prepare SonarQube scanner's analysis
Build my VisualStudio project with MSBuild
Run nunit and opencover with a batch command line
End SonarQube scanner's analysis
Package the project
END EDIT
The nUnit's report is well generated in workspace/reports/TestResult.xml.
I tested the analysis generation by command line and via the sonarqube plugin for jenkins. I got the same results.
Can you see anything wrong?
Is there any SonarQube's logs that I could checked ?
I am using Jenkins 2.10, MSBuild 12, SonarQube 5.6, SonarQube scanner for Jenkins plugin 2.4.3, opencover 4.5 and nunit 2.6.4
EDIT
I updated my config : Jenkins 2.18, MSBuild 14, SonarQube scanner for Jenkins plugin 2.4.4. Same results.
END EDIT
Take a look at: SonarQube documentation: Unit Test Execution Results Import (C#, VB.NET)
It says:
Drilldown on Test Execution Results is not supported
My understanding is that you can only see the results (number of Tests passing, errors, etc) but not detail from the tests.
You also ask about Logs. You have:
Jenkins Job log
SonarQube Background tasks: Login as Admin -> Administration -> Projects -> Background tasks -> far right of each execution ---> http://docs.sonarqube.org/display/SONAR/Background+Tasks
SonarQube logs: sonar_install_directory\logs

Unit test not showing up in SonarQube

Using Jenkins I am trying to pass the result of the Nunit task and the OpenCover task to SonarQube.
SonarQube displays properly the test coverage but there is no trace of unit test results.
Here is what I do :
Build Visual Studio project with MSBuild
Batch windows for opencover via nunit
Launch SonarQube scanner
Batch windows for deployement
Here is my actual properties for the Sonar Scanner task:
sonar.projectKey=FC
sonar.projectName=FC
sonar.projectVersion=%SVN_REVISION%
sonar.sources=src
sonar.binaries=build
sonar.exclusions=src/FC.Test/**/*.*
sonar.tests=src/FC.Test
sonar.cs.nunit.reportsPaths=TestResult.xml
sonar.cs.opencover.reportsPaths=reports/opencovertests.xml
I'm using SonarQube 5.6, Jenkins 2.10, SonarQube plugin 2.4.3, OpenCover 4.5 and Nunit 2.6.4
Is there any known problems (compatibility issues...) ?
Note that I tryed to wrap my process with the Prepare and Terminate Sonar analysis tasks but it systematicaly deletes the coverage panel. So i removed it.
EDIT 2017
I stopped doing this way. I understood that the good way to do this was using the SonarQube Scanner for MSBuild which is integrated at the Jenkins's plugin.
The coverage panel was not shown because i didn't configure my quality profiles properly.
But...
I still don't have my tests' result in Sonar.
I checked the absolute path of my report and its parsing by sonarQube : "INFO: Sensor C# Unit Test Results Import [csharp] (done) | time=25ms". I also tryed with a .nunit file. I saw that apply a filter to opencover could help, so I did.
Do you have a clue?
Scanning C# projects requires to use the Sonar Scanner for MSBuild and follow a specific 3 steps process which I guess you don't follow for now. See doc about the 3 steps process at: http://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner+for+MSBuild and http://docs.sonarqube.org/display/SCAN/From+Jenkins
Your properties look correct. Yet they shall not be provided in a sonar properties file but instead in the command line arguments of the MSBuild.SonarQube.Runner.exe begin step, for example:
MSBuild.SonarQube.Runner.exe begin <allMandatoryParameters> /d:sonar.cs.nunit.reportsPaths=TestResult.xml /d:sonar.cs.opencover.reportsPaths=reports\opencovertests.xml
Olivier

How to get modules' coverage via sonar runner in jenkins

What we have:
jenkins 1.6 + SonarQube 4.5.6 + sonnar-runner 2.4 + maven 3.0.5
Issue Description:
We use 'Invoke Standalone SonarQube Analysis' in jobs' configuration, and it works fine except that it cannot get test coverage while the analysis just try to parsing the <base_dir>/target/site/cobertura/coverage.xml. But we have coverage.xml in the modules directory instead, just like <base_dir>/module1/target/site/cobertura/coverage.xml
I have tried to set sonar modules, but nothing happened, we still cannot get the coverage data.
Previously, we used sonar-maven-plugin for the analysis, but after we upgrade to SonarQube 4.5.6, we met some issues, like api incompatibility, measure twice, and so we changed to use sonar-runner. sonar-maven-plugin works fine to parsing the modules' coverage.xml.
How can we retrieve the coverage data in the modules' directory.
Or how can we merge the modules coverage.xml into one coverage.xml in the root directory for sonar-runner to parse.
Any comment? Thanks very much!

Grails Test Case summary Report

while running the test-app command , i only get the below Test Case summary report if i REMOVE the xalan-2.4.0 from Lib directory in grails project.
Tests with failure and errors
Package summary
Show all tests
Can anyone suggest me what will be the reason behind that ?

"javax.inject.Inject" is not recognized

I have a simple Gradle project.
I have the following in my build.gradle:
compile('javax.inject:javax.inject:1')
And I can see the jar in gradle cache. But in both Eclipse and IDEA I get following message
Error:(8, 20) java: package javax.inject does not exist
The really odd thing is that :build is successful, but there is an IDE message and an error when trying to "run".
I tried creating a Maven project and there I can import "#Inject" just fine.

Resources