Sonarqube and working with multiple unit test reports

1.5k Views Asked by At

I have a Web Application using a mix of C# and JavaScript / Type Script. I'm trying to get code coverage and unit test results for both language types here. Individually this works fine, but when attempting to run both its a no go.

The coverage is fine but the importing of unit test reports isn't

Running this from a Windows Jenkins setup and trying to get code coverage from both here with the following switches.

/d:sonar.cs.vstest.reportsPaths="$WORKSPACE\MSTestResults.trx"
/d:sonar.cs.vscoveragexml.reportsPaths="$WORKSPACE\MSTestResults.coveragexml"
/d:sonar.javascript.lcov.reportPath="$WORKSPACE\JavaScript_Coverage.lcov"
/d:sonar.genericcoverage.unitTestReportPaths="$WORKSPACE\JavaScriptUnitTest.xml"
/d:sonar.tests="$WORKSPACE\iag.digitalweb.selfservice.portal\scripts\tests"

Running this configuration results in:

INFO  - Parsing the Visual Studio coverage XML report C:\workspace\Self service portal Test\MSTestResults.coveragexml
INFO  - Sensor org.sonar.plugins.csharp.CSharpCodeCoverageProvider$CSharpCoverageReportImportSensor@cdac87d (done) | time=15ms
INFO  - Sensor org.sonar.plugins.csharp.CSharpUnitTestResultsProvider$CSharpUnitTestResultsImportSensor@2fc41b82
INFO  - Parsing the Visual Studio Test Results file C:\workspace\Self service portal Test\MSTestResults.trx
INFO  - Sensor org.sonar.plugins.csharp.CSharpUnitTestResultsProvider$CSharpUnitTestResultsImportSensor@2fc41b82 (done) | time=16ms
INFO  - Sensor GenericCoverageSensor
INFO  - Imported coverage data for 0 files
INFO  - Imported IT coverage data for 0 files
INFO  - Imported Overall coverage data for 0 files
INFO  - Parsing C:\workspace\Self service portal Test\JavaScriptUnitTest.xml
INFO  - Imported unit test data for 0 files ....
ERROR: Error during Sonar runner execution org.sonar.runner.impl.RunnerException: Unable to execute Sonar
  at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:91)
  at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75)
  at java.security.AccessController.doPrivileged(Native Method)
  at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69)
  at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
  at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102)
  at org.sonar.runner.api.Runner.execute(Runner.java:100)
  at org.sonar.runner.Main.executeTask(Main.java:70)
  at org.sonar.runner.Main.execute(Main.java:59)
  at org.sonar.runner.Main.main(Main.java:53)
Caused by:
  org.sonar.api.utils.SonarException: Fail to decorate 'org.sonar.api.resources.Project@64d394e5[id=22114,key=SelfServiceTest,qualifier=TRK]'
  at org.sonar.batch.phases.DecoratorsExecutor.executeDecorator(DecoratorsExecutor.java:104)
  at org.sonar.batch.phases.DecoratorsExecutor.decorateResource(DecoratorsExecutor.java:87)
  at org.sonar.batch.phases.DecoratorsExecutor.execute(DecoratorsExecutor.java:71)
  at org.sonar.batch.phases.DatabaseModePhaseExecutor.execute(DatabaseModePhaseExecutor.java:127)
  at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:264)
  at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
  at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
  at org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.java:235)
  at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:230)
  at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:220)
  at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
  at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
  at org.sonar.batch.scan.ScanTask.scan(ScanTask.java:57)
  at org.sonar.batch.scan.ScanTask.execute(ScanTask.java:45)
  at org.sonar.batch.bootstrap.TaskContainer.doAfterStart(TaskContainer.java:135)
  at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
  at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
  at org.sonar.batch.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:158)
  at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:95)
  at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:67)
  at org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java:48)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:497)
  at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87) ... 9 more
Caused by:
  org.sonar.api.utils.SonarException: Can not add twice the same measure on org.sonar.api.resources.Project@64d394e5[id=22114,key=SelfServiceTest,qualifier=TRK]: org.sonar.api.measures.Measure@cb06460[metricKey=skipped_tests,metric=Metric[id=32,key=skipped_tests,description=Number of skipped unit tests,type=INT,direction=-1,domain=<null>,name=skipped_tests,qualitative=true,userManaged=false,enabled=true,origin=JAV,worstValue=<null>,bestValue=0.0,optimizedBestValue=true,hidden=false,deleteHistoricalData=false],value=0.0,data=<null>,description=<null>,alertStatus=<null>,alertText=<null>,tendency=<null>,date=<null>,variation1=<null>,variation2=<null>,variation3=<null>,variation4=<null>,variation5=<null>,url=<null>,characteristic=<null>,requirement=<null>,personId=<null>,persistenceMode=FULL,fromCore=false]

Has anyone dealt with this before or have an example of a valid multi language unit test report using two different report types?

Working with the following:

  • SonarQube 5.0
  • JavaScript 2.10
  • C# 4.5
  • Windows 2012 server
0

There are 0 best solutions below