ant - JaCoCo Selenium 测试代码覆盖率并使用 Ant 导入 Sonar

标签 ant selenium jenkins sonarqube jacoco

我正在通过 Ant 运行 Sonar 任务,由 RHEL 环境中的 Jenkins 触发。我成功地将 Cobertura 用于 Junit 代码覆盖并使用 Surefire 进行报告。 Sonar 可以很好地导入 Surefire 报告。

但是,现在我在 Jenkins 中使用 Ant 运行 Selenium 测试。我想向 Sonar 报告代码覆盖率和测试结果。显然我需要分析代码覆盖率和报告测试的 JaCoCo 插件。我假设对于单元测试,Jenkins 会完成这项工作,而 Sonar 只会将报告导入到它自己的存储库中。

我对如何真正做到这一点感到困惑。网页http://www.sonarsource.org/measure-coverage-by-integration-tests-with-sonar-updated/对 JaCoCo 页面的引用 http://www.eclemma.org/jacoco/trunk/doc/ant.html .我不确定要完成哪些步骤。我需要覆盖目标吗?我应该只启动代理吗?我在 Ant 的哪个位置启动代理?我需要倒东西吗?

我非常感谢能得到的所有帮助,谢谢 :)

最佳答案

Sonar 3.3 具有一项新功能,可以组合由单元测试和集成测试生成的代码覆盖率指标。这是通过使用两个属性来详细说明 jacoco 生成的两个不同的报告文件来完成的。也是:

#Tells Sonar where the unit tests code coverage report is
sonar.jacoco.reportPath=reports/jacoco/jacoco-ut.exec

#Tells Sonar where the integration tests code coverage report is
sonar.jacoco.itReportPath=reports/jacoco/jacoco-it.exec

Sonar 示例项目有一个 ANT 的集成测试示例:

遗憾的是,它没有给出运行实际测试的示例,而只是展示了如何配置 ANT 构建以加载数据。

最后 Sonar documentation包含指向示例项目的链接的更多详细信息。

关于ant - JaCoCo Selenium 测试代码覆盖率并使用 Ant 导入 Sonar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13048380/

相关文章:

android - 无法使用 Ant 从外部 jar 构建多个 Android dex 文件

php - Phing 未加载 .properties 文件

email - Ant 邮件任务 - 发送带有附件的邮件时出现问题

c# - 在 C# 中使用 Selenium Webdriver,如何选择要写入的文本框,然后写入其中?

python - 我们如何在机器人框架中一次通过不同的浏览器

Apache Ant : Is it possible to insert/replace with text from a raw text file?

c# - 如何通过 Selenium 获取 Chrome 上当前事件的选项卡索引?

cucumber - 使用 Gems 或 Jenkins(或两者)在多台机器上并行 Cucumber BDD 测试

python - 如何在多进程系统中实现锁?

Jenkins 管道代码通过 GitHub 组织文件夹插件自动触发多个存储库