• <tfoot id='sl0eV'></tfoot>
    <i id='sl0eV'><tr id='sl0eV'><dt id='sl0eV'><q id='sl0eV'><span id='sl0eV'><b id='sl0eV'><form id='sl0eV'><ins id='sl0eV'></ins><ul id='sl0eV'></ul><sub id='sl0eV'></sub></form><legend id='sl0eV'></legend><bdo id='sl0eV'><pre id='sl0eV'><center id='sl0eV'></center></pre></bdo></b><th id='sl0eV'></th></span></q></dt></tr></i><div id='sl0eV'><tfoot id='sl0eV'></tfoot><dl id='sl0eV'><fieldset id='sl0eV'></fieldset></dl></div>
    1. <legend id='sl0eV'><style id='sl0eV'><dir id='sl0eV'><q id='sl0eV'></q></dir></style></legend>

      <small id='sl0eV'></small><noframes id='sl0eV'>

        • <bdo id='sl0eV'></bdo><ul id='sl0eV'></ul>

        客户端/服务器 Web 应用程序的代码覆盖率

        Code coverage of client/server web application(客户端/服务器 Web 应用程序的代码覆盖率)

            <tbody id='hW1h9'></tbody>
          <i id='hW1h9'><tr id='hW1h9'><dt id='hW1h9'><q id='hW1h9'><span id='hW1h9'><b id='hW1h9'><form id='hW1h9'><ins id='hW1h9'></ins><ul id='hW1h9'></ul><sub id='hW1h9'></sub></form><legend id='hW1h9'></legend><bdo id='hW1h9'><pre id='hW1h9'><center id='hW1h9'></center></pre></bdo></b><th id='hW1h9'></th></span></q></dt></tr></i><div id='hW1h9'><tfoot id='hW1h9'></tfoot><dl id='hW1h9'><fieldset id='hW1h9'></fieldset></dl></div>
            <bdo id='hW1h9'></bdo><ul id='hW1h9'></ul>

            <small id='hW1h9'></small><noframes id='hW1h9'>

            <legend id='hW1h9'><style id='hW1h9'><dir id='hW1h9'><q id='hW1h9'></q></dir></style></legend>

                <tfoot id='hW1h9'></tfoot>

                • 本文介绍了客户端/服务器 Web 应用程序的代码覆盖率的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在编写一个多模块应用程序.一些模块只是基本的 Java 库,然后包含在 webapp 的 WAR 中.

                  I am writing a multi-module application. Some of the modules are just basic Java libraries which are then included in the WAR of a webapp.

                  我想在以下场景中运行代码覆盖:

                  I would like to run code coverage in the following scenario:

                  • 我正在通过一个通过 Maven 启动的嵌入式 Jetty 运行 webapp.

                  • I am running the webapp through an embedded Jetty that is started via Maven.

                  我有针对 webapp 执行 HTTP 请求的测试.

                  I have tests which are executing HTTP requests against the webapp.

                  我想获得包含在 webapp 和测试中的代码.

                  I would like to get code covered in the webapp and also by the tests.

                  这可能吗?如何使用 Cobertura、JaCoCo 或 Emma 来实现?据我了解,在这种情况下,代码覆盖率只会覆盖客户端代码.我说的对吗?

                  Is this possible and how can it be achieved with Cobertura, JaCoCo or Emma? From what I understand, the code coverage will only cover the client-side code in this scenario. Am I correct?

                  推荐答案

                  我是这样实现的

                  假设你已经有一个最小的 pom.xml 配置:

                  Assuming you already have a minimal pom.xml config:

                  <plugin>
                    <groupId>org.jacoco</groupId>
                    <artifactId>jacoco-maven-plugin</
                    <version>0.7.4.201502262128</vers
                  </plugin>
                  

                  1. 下载JaCoCo的代理并将jacocoagent.jar复制到合适的位置(例如$HOME/tools/jacocoagent0.7.4.jar)

                  1. Download JaCoCo's agent and copy jacocoagent.jar to a suitable location (e.g. $HOME/tools/jacocoagent0.7.4.jar)

                  通过以下方式将 JaCoCo 的代理连接到 Maven 的 JVM:

                  Attach JaCoCo's agent to Maven's JVM via:

                  export MAVEN_OPTS="$MAVEN_OPTS 
                  -javaagent:$HOME/tools/jacocoagent0.7.4.jar=output=tcpserver,port=6300"
                  

                • 使用嵌入式码头服务器运行您的应用程序,例如mvn jetty:run

                  运行您的集成测试

                  在另一个 shell 中,通过 mvn jacoco:dump jacoco:report

                  In another shell, dump and report via mvn jacoco:dump jacoco:report

                  ./target/site/index.html 上打开您的报告(默认)

                  Open your report on ./target/site/index.html (by default)

                  这篇关于客户端/服务器 Web 应用程序的代码覆盖率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!
                • 相关文档推荐

                  How to send data to COM PORT using JAVA?(如何使用 JAVA 向 COM PORT 发送数据?)
                  How to make a report page direction to change to quot;rtlquot;?(如何使报表页面方向更改为“rtl?)
                  Use cyrillic .properties file in eclipse project(在 Eclipse 项目中使用西里尔文 .properties 文件)
                  Is there any way to detect an RTL language in Java?(有没有办法在 Java 中检测 RTL 语言?)
                  How to load resource bundle messages from DB in Java?(如何在 Java 中从 DB 加载资源包消息?)
                  How do I change the default locale settings in Java to make them consistent?(如何更改 Java 中的默认语言环境设置以使其保持一致?)
                  <tfoot id='WObal'></tfoot>
                  <i id='WObal'><tr id='WObal'><dt id='WObal'><q id='WObal'><span id='WObal'><b id='WObal'><form id='WObal'><ins id='WObal'></ins><ul id='WObal'></ul><sub id='WObal'></sub></form><legend id='WObal'></legend><bdo id='WObal'><pre id='WObal'><center id='WObal'></center></pre></bdo></b><th id='WObal'></th></span></q></dt></tr></i><div id='WObal'><tfoot id='WObal'></tfoot><dl id='WObal'><fieldset id='WObal'></fieldset></dl></div>
                • <small id='WObal'></small><noframes id='WObal'>

                    1. <legend id='WObal'><style id='WObal'><dir id='WObal'><q id='WObal'></q></dir></style></legend>

                          <bdo id='WObal'></bdo><ul id='WObal'></ul>
                            <tbody id='WObal'></tbody>