Yii2 共接受;SonarQube PHP[无法读取phpUnit报告]
我正在Yii2中通过竹CI服务器运行Codeception,并使用SonarQube帮助运行分析 到目前为止,我已经设法让SonarPHP来分析PHP——这很好。但我没能让它包括报道报道。我正在以三叶草的形式制作报道 这是我的codecept命令:Yii2 共接受;SonarQube PHP[无法读取phpUnit报告],yii2,sonarqube,codeception,Yii2,Sonarqube,Codeception,我正在Yii2中通过竹CI服务器运行Codeception,并使用SonarQube帮助运行分析 到目前为止,我已经设法让SonarPHP来分析PHP——这很好。但我没能让它包括报道报道。我正在以三叶草的形式制作报道 这是我的codecept命令: ${bambor.php}${bambor.composer}exec codecept运行单元模型/HelperTest.php--xml--coverage--coverage xml sonar.projectKey=CR sonar.proj
${bambor.php}${bambor.composer}exec codecept运行单元模型/HelperTest.php--xml--coverage--coverage xml
sonar.projectKey=CR
sonar.projectName=CCasper Reporting
sonar.projectVersion=4.0
sonar.language=php
sonar.sources=models, controllers, components, modules/api/models, modules/api/controllers
sonar.sourceEncoding=UTF-8
sonar.tests=tests/api/models, tests/unit/models
sonar.php.tests.reportPath=tests/bamboo/report.xml
sonar.php.coverage.reportPath=tests/bamboo/coverage.xml
sonar.php.coverage.itReportPath=tests/bamboo/coverage.xml
sonar.coverage.exclusions=tests/*.php
java.lang.IllegalStateException:无法读取phpUnit报告:report.xml
原因:com.thoughtworks.xstream.mapper.CannotResolveClassException:testsuites:testsuites
我假设这是因为生成的文件:
<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
<testsuite name="unit" tests="2" assertions="2" errors="0" failures="0" skipped="0" time="0.015625">
<testcase name="testGetRange" class="tests\models\HelperTest" file="C:\bamboo-home\xml-data\build-dir\CR-QA-JOB1\tests\unit\models\HelperTest.php" assertions="1" time="0.015625"/>
<testcase name="testBadDateCheckerParam" class="tests\models\HelperTest" file="C:\bamboo-home\xml-data\build-dir\CR-QA-JOB1\tests\unit\models\HelperTest.php" assertions="1" time="0.000000"/>
</testsuite>
</testsuites>
因此,我的问题是,如何让PHP 5.5.6正确地包含覆盖范围?我在这方面花了更多的时间,并使用以下设置成功地集成了代码覆盖范围
${bambor.php}${bambor.composer}exec codecept run--verbose--xml--coverage--coverage-xml--coverage-html--no exit
--xml
参数创建JUNIT文件。
在竹子构建中添加一个JUNIT任务,在我的例子中,路径是/tests/bambol/*.xml
。这是特定于Yii2和我自定义创建的竹文件夹
--coverage
,--coverage xml
,--coverage html
创建三叶草样式的覆盖项目
在竹的杂项部分的建设,你可以启用三叶草覆盖。由于这是用Yii打包的,您只需单击“Clover已经集成到此构建中,并且将生成Clover.xml文件”选项并指定.xml文件的路径
我的是:tests/bambol/coverage.xml
然后我运行声纳扫描仪。Im我的项目根我有以下声纳属性文件
我的Sonar PHP文件(5.56 SonarQube)是从Sonar服务器web界面下载的最新PHP插件
sonar.projectKey=CR
sonar.projectName=CCasper报告
sonar.projectVersion=4.0
sonar.language=php
声纳。来源=模型、控制器、组件、模块/api/模型、模块/api/控制器
sonar.sourceEncoding=UTF-8
sonar.php.coverage.reportPath=tests/bambol/coverage.xml
这似乎对我起到了作用您使用的SonarPHP和SQ的版本是什么?嗨@ElenaVilchik我已经回答了下面的问题。让我知道我的设置中是否缺少一些可能对其他人有用的内容。您停止提供“sonar.php.tests.reportPath”(单元测试结果),这部分最初失败了。