Sonarqube并使用多个单元测试报告

时间:2016-03-08 09:46:12

标签: unit-testing sonarqube sonarqube-5.0

我有一个使用C#和JavaScript / Type Script混合的Web应用程序。 我试图在这里获得两种语言类型的代码覆盖率和单元测试结果。单独地,这可以正常工作,但是当试图同时运行它时,不行。

保险范围很好,但单位测试报告的导入不是

从Windows Jenkins设置运行此命令,并尝试使用以下开关从这两者获取代码覆盖率。

/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"

运行此配置会导致:

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]

之前是否有人处理此问题或使用两种不同的报告类型获得有效的多语言单元测试报告示例?

使用以下内容:

  • SonarQube 5.0
  • JavaScript 2.10
  • C#4.5
  • Windows 2012服务器

0 个答案:

没有答案