Details
Description
I have a project with a test directory which have several test files, when I run mvn sonar:sonar with following options (in my pom.xml file):
sonar.language=php
sonar.dynamicAnalysis=true
(sonar.phpPmd.shouldRun=false
sonar.phpDepend.shouldRun=false
sonar.phpcpd.shouldRun=false)
sonar.phpUnit.coverage.shouldRun=true
sonar.phpUnit.shouldRun=true
I have the following error :
Embedded error: Can not add twice the same measure:
org.sonar.api.measures.Measure@10bed9c[
id=<null>,
metricKey=test_execution_time,
metric=org.sonar.api.measures.Metric@1bb3e9a[
key=test_execution_time,
name=Unit tests duration,
type=MILLISEC,enabled=true,
qualitative=false,
direction=-1,
domain=Tests,
worstValue=<null>,
bestValue=<null>,
optimizedBestValue=<null>,
hidden=false],
value=891.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>
persistenceMode=FULL]
The generated phpunit.xml file is formatted as following (phpunit command format)
<testsuites>
<testsuite ...>
<testsuite ...>
</testsuite>
<testsuite ...>
</testsuite>
</testsuite>
</testsuites>
Issue Links
- depends upon
-
SONARPLUGINS-1391
Refactor the way PHP plugin handles resources
-
Cloned from http://jira.codehaus.org/browse/SONARPLUGINS-916
I have the same issue with 0.4 and sonar.dynamicAnalysis=false
If my phpunit.xml log file has this kind of structure :
<testsuites>
<testsuite>
<testsuite>
<testcase />
</testsuite>
<testsuite>
<testcase />
</testsuite>
</testsuite>
</testsuites>
Then, I have "Embedded error: Can not add twice the same measure on org.sonar.api.resources" error. But if I keep only 1 test file (commenting testcases in the other tests files, but keeping the files !), I have no error. Here is the kind of phpunit.xml log file generated that works :
<testsuites>
<testsuite>
<testsuite /><!-- no testcase ! -->
<testsuite>
<testcase />
</testsuite>
</testsuite>
</testsuites>