当前位置: 首页 > news >正文

wordpress网站在哪东莞网站建设优化企业

wordpress网站在哪,东莞网站建设优化企业,做ghost系统的网站有哪些,北京4a广告公司有哪些当我开始使用Java 7时#xff0c;我立即注意到Cobertura Maven插件不支持它 。 这对我来说是个大问题#xff0c;因为我每天都使用代码覆盖率报告。 我做了一些研究#xff0c;发现了JaCoCo代码覆盖库 。 看起来很有趣#xff0c;我决定试一试。 问题在于配置它确实很困难… 当我开始使用Java 7时我立即注意到Cobertura Maven插件不支持它 。 这对我来说是个大问题因为我每天都使用代码覆盖率报告。 我做了一些研究发现了JaCoCo代码覆盖库 。 看起来很有趣我决定试一试。 问题在于配置它确实很困难并且花费了大量时间。 我阅读了许多教程只是发现其中给出的说明对我不起作用。 然后我遇到了这个博客文章 一切都准备就绪。 尽管该博客文章对我来说非常有价值但它有点含糊。 我认为对JaCoCo Maven插件的用法进行更详细的解释很有价值。 这篇博客文章描述了我们如何使用JaCoCo Maven插件为单元和集成测试创建代码覆盖率报告。 我们的构建要求如下 运行测试时我们的构建必须为单元测试和集成测试创建代码覆盖率报告。 代码覆盖率报告必须在单独的目录中创建。 换句话说必须将用于单元测试的代码覆盖率报告创建到与用于集成测试的代码覆盖率报告不同的目录中。 让我们开始吧。 注意 此博客文章的示例应用程序基于我的博客文章“ Maven集成测试”的示例应用程序。 如果尚未阅读建议您在阅读此博客文章之前先阅读它。 配置JaCoCo Maven插件 我们使用JaCoCo Maven插件有两个目的 它使我们可以访问JaCoCo运行时代理 该代理记录了执行覆盖率数据。 它根据JaCo​​Co运行时代理记录的执行数据创建代码覆盖率报告。 我们可以按照以下步骤配置JaCoCo Maven插件 将JaCoCo Maven插件添加到我们的POM文件的插件部分。 为单元测试配置代码覆盖率报告。 配置代码覆盖率报告以进行集成测试。 下面将更详细地描述这些步骤。 将JaCoCo Maven插件添加到POM文件 通过将以下插件声明添加到其“ 插件”部分我们可以将JaCoCo Maven插件添加到我们的POM文件中 plugingroupIdorg.jacoco/groupIdartifactIdjacoco-maven-plugin/artifactIdversion0.6.3.201306030806/version /plugin 让我们继续前进了解如何为单元测试配置代码覆盖率报告。 配置单元测试的代码覆盖率报告 我们可以通过将两个执行添加到插件声明中来为单元测试配置代码覆盖率报告。 这些执行方式如下所述 第一次执行将创建一个指向JaCoCo运行时代理的属性。 确保执行数据已写入文件target / coverage-reports / jacoco-ut.exec 。 将该属性的名称设置为surefireArgLine 。 运行单元测试时此属性的值作为VM参数传递。 运行单元测试后第二次执行将为单元测试创建代码覆盖率报告 。 确保从文件target / coverage-reports / jacoco-ut.exec中读取执行数据并将代码覆盖率报告写入目录target / site / jacoco-ut中 。 我们的插件配置的相关部分如下所示 plugingroupIdorg.jacoco/groupIdartifactIdjacoco-maven-plugin/artifactIdversion0.6.3.201306030806/versionexecutions!--Prepares the property pointing to the JaCoCo runtime agent whichis passed as VM argument when Maven the Surefire plugin is executed.--executionidpre-unit-test/idgoalsgoalprepare-agent/goal/goalsconfiguration!-- Sets the path to the file which contains the execution data. --destFile${project.build.directory}/coverage-reports/jacoco-ut.exec/destFile!--Sets the name of the property containing the settingsfor JaCoCo runtime agent.--propertyNamesurefireArgLine/propertyName/configuration/execution!--Ensures that the code coverage report for unit tests is created afterunit tests have been run.--executionidpost-unit-test/idphasetest/phasegoalsgoalreport/goal/goalsconfiguration!-- Sets the path to the file which contains the execution data. --dataFile${project.build.directory}/coverage-reports/jacoco-ut.exec/dataFile!-- Sets the output directory for the code coverage report. --outputDirectory${project.reporting.outputDirectory}/jacoco-ut/outputDirectory/configuration/execution/executions /plugin 让我们找出如何为集成测试配置代码覆盖率报告。 配置集成测试的代码覆盖率报告 我们可以通过在插件声明中添加两个执行来为集成测试配置代码覆盖率报告。 这些执行方式如下所述 第一次执行将创建一个指向JaCoCo运行时代理的属性。 确保将执行数据写入文件target / coverage-reports / jacoco-it.exec 。 将该属性的名称设置为failsafeArgLine 。 运行我们的集成测试时此属性的值作为VM参数传递。 创建一个执行该执行在集成测试运行后为集成测试创建代码覆盖率报告 。 确保从文件target / coverage-reports / jacoco-it.exec中读取执行数据并将代码覆盖率报告写入目录target / site / jacoco-it 。 我们的插件配置的相关部分如下所示 plugingroupIdorg.jacoco/groupIdartifactIdjacoco-maven-plugin/artifactIdversion0.6.3.201306030806/versionexecutions!-- The Executions required by unit tests are omitted. --!--Prepares the property pointing to the JaCoCo runtime agent whichis passed as VM argument when Maven the Failsafe plugin is executed.--executionidpre-integration-test/idphasepre-integration-test/phasegoalsgoalprepare-agent/goal/goalsconfiguration!-- Sets the path to the file which contains the execution data. --destFile${project.build.directory}/coverage-reports/jacoco-it.exec/destFile!--Sets the name of the property containing the settingsfor JaCoCo runtime agent.--propertyNamefailsafeArgLine/propertyName/configuration/execution!--Ensures that the code coverage report for integration tests afterintegration tests have been run.--executionidpost-integration-test/idphasepost-integration-test/phasegoalsgoalreport/goal/goalsconfiguration!-- Sets the path to the file which contains the execution data. --dataFile${project.build.directory}/coverage-reports/jacoco-it.exec/dataFile!-- Sets the output directory for the code coverage report. --outputDirectory${project.reporting.outputDirectory}/jacoco-it/outputDirectory/configuration/execution/executions /plugin 而已。 现在我们已经配置了JaCoCo Maven插件。 下一步是配置Maven Surefire插件。 让我们找出如何做到这一点。 配置Maven Surefire插件 我们使用Maven Surefire插件运行示例应用程序的单元测试。 因为我们要为单元测试创​​建代码覆盖率报告所以我们必须确保在运行单元测试时JaCoCo代理正在运行。 我们可以通过添加surefireArgLine属性作为argLine配置参数的值的值确保这一点。 Maven Surefire插件的配置如下所示突出显示了所需的更改 plugingroupIdorg.apache.maven.plugins/groupIdartifactIdmaven-surefire-plugin/artifactIdversion2.15/versionconfiguration!-- Sets the VM argument line used when unit tests are run. --argLine${surefireArgLine}/argLine!-- Skips unit tests if the value of skip.unit.tests property is true --skipTests${skip.unit.tests}/skipTests!-- Excludes integration tests when unit tests are run. --excludesexclude**/IT*.java/exclude/excludes/configuration /plugin 我们快完成了。 剩下要做的就是配置Maven Failsafe插件。 让我们找出如何做到这一点。 配置Maven故障安全插件 我们的示例应用程序的集成测试由Maven Failsafe插件运行。 因为我们要为集成测试创建代码覆盖率报告所以我们必须确保在运行集成测试时JaCoCo代理正在运行。 我们可以通过将failsafeArgLine属性的值添加为argLine配置参数的值来实现。 Maven Failsafe插件的配置如下所示突出显示了所需的更改 plugingroupIdorg.apache.maven.plugins/groupIdartifactIdmaven-failsafe-plugin/artifactIdversion2.15/versionexecutions!--Ensures that both integration-test and verify goals of the Failsafe Mavenplugin are executed.--executionidintegration-tests/idgoalsgoalintegration-test/goalgoalverify/goal/goalsconfiguration!-- Sets the VM argument line used when integration tests are run. --argLine${failsafeArgLine}/argLine!--Skips integration tests if the value of skip.integration.tests propertyis true--skipTests${skip.integration.tests}/skipTests/configuration/execution/executions /plugin创建代码覆盖率报告 现在我们已成功完成所需的配置。 让我们看看如何为单元测试和集成测试创建代码覆盖率报告。 此博客文章的示例应用程序具有三个构建配置文件下面对此进行了描述 开发配置文件在开发过程中使用它是我们构建的默认配置文件。 当此配置文件处于活动状态时仅运行单元测试。 集成测试概要文件用于运行集成测试。 所有测试配置文件用于运行单元测试和集成测试。 我们可以通过在命令提示符处运行以下命令来创建不同的代码覆盖率报告 命令mvn clean test运行单元测试并为目录target / site / jacoco-ut创建单元测试的代码覆盖率报告。 命令mvn clean verify -P integration-test运行集成测试并为目录target / site / jacoco-it创建用于集成测试的代码覆盖率报告。 命令mvn clean verify -P all-tests运行单元测试和集成测试并为单元测试和集成测试创建代码覆盖率报告。 今天就这些。 与往常一样此博客文章的示例应用程序可在Github上获得 。 参考 Petri Kainulainen博客上的JCG合作伙伴 Petri Kainulainen 使用JaCoCo Maven插件为单元和集成测试创建代码覆盖率报告 。 翻译自: https://www.javacodegeeks.com/2013/08/creating-code-coverage-reports-for-unit-and-integration-tests-with-the-jacoco-maven-plugin.html
http://www.yutouwan.com/news/310704/

相关文章:

  • 有产品做推广 选哪个 网站开发小程序定制公司
  • 不备案的网站有那些网站开发网上宠物店管理系统
  • 网站美化教程下载做培训网站前端
  • 时光轴网站模板空间登录
  • 做网站不给源码上海互联网公司
  • 哪个网站注册域名好高端网站设计元素图片
  • 国外做锅炉的网站网站访问代理在线
  • 怎样建立个人网站?大学生网络营销策划书模板
  • 网站跳出率是什么意思ios软件开发需要学什么
  • 做旅行网站的意义物业网站建设
  • 怎样做交互式网站深圳网站制作公司排名
  • 官网网站备案网络游戏排行榜2021前十名手游
  • 广州建网站技术2345浏览器手机版
  • 个人网站 flash鲜花类网站建设策划书范文
  • 用宝塔做网站步骤点点 网站建设
  • 网站建设推广市场wordpress 七牛不更新
  • 网页设计与网站建设电话python做网站优势
  • 做智能网站平台已购买域名 如何做网站
  • 最专业微网站首选公司免费html网站开发教程
  • 网站由哪些部分组成部分组成部分组成线下推广平台有哪些
  • 四川建设主管部门网站做网站贵么
  • 在线建站平台营销型网站制作哪个好薇
  • 建个公司网站要多少钱京东网页设计教程
  • 以前做视频的网站吗互联网门户网站是什么意思
  • 企业宣传网站设计论文绵阳市网站建立
  • 有服务器自己怎么做网站响应式表白网站源码
  • 成都网络优化网站建设电子商务网站的建设视频
  • 课程网站开发流程图及原型图做微信的网站有哪些
  • 中小学 网站建设 通知可以做网站的路由器
  • 郑州网站个人开发商业空间设计有限公司