代码覆盖率适用于使用Node编写的测试框架,而应用程序则是用Java编写的。

huangapple 未分类评论57阅读模式
英文:

Code coverage for test framework written in Node and application is in Java

问题

我已经编写了我的测试框架,它是一个 Node.js 服务,而应用程序是用 Java 编写的。我想要了解如何获取代码覆盖率?我尝试使用了 Jacoco,但它没有生成任何覆盖率详细信息。在 Node.js 项目中是否有 Jacoco 的依赖项需要使用?或者在这种情况下是否有其他生成代码覆盖率的方法?

我已经在 pom.xml 中添加了以下依赖项:

<plugin>
    <groupId>org.jacoco</groupId>
    <artifactId> jacoco-maven-plugin </artifactId>
    <version>0.7.1.201405082137</version>
    <executions>
        <execution>
            <id>default-prepare-agent</id>
            <goals>
                <goal>prepare-agent</goal>
            </goals>
        </execution>
        <execution>
            <id>default-report</id>
            <phase>prepare-package</phase>
            <goals>
                <goal>report</goal>
            </goals>
        </execution>
        <execution>
            <id>default-check</id>
            <goals>
                <goal>check</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <dataFile>target/jacoco.exec</dataFile>
        <outputDirectory>/target/jacoco</outputDirectory>
    </configuration>
</plugin>
英文:

I have written my test framework which is a node service and the application is written in Java. I want to understand how to get code coverage? I have tried to use Jacoco but it did not generate any coverage details. Is there any dependency for node projects for jacoco that I should use ? Or is there any other way of generating code coverage for this type of scenario ?

I have added dependencies to pom.xml as here

				&lt;groupId&gt;org.jacoco&lt;/groupId&gt;
				&lt;artifactId&gt;jacoco-maven-plugin&lt;/artifactId&gt;
				&lt;version&gt;0.7.1.201405082137&lt;/version&gt;
				&lt;executions&gt;
					&lt;execution&gt;
						&lt;id&gt;default-prepare-agent&lt;/id&gt;
						&lt;goals&gt;
							&lt;goal&gt;prepare-agent&lt;/goal&gt;
						&lt;/goals&gt;
					&lt;/execution&gt;
					&lt;execution&gt;
						&lt;id&gt;default-report&lt;/id&gt;
						&lt;phase&gt;prepare-package&lt;/phase&gt;
						&lt;goals&gt;
							&lt;goal&gt;report&lt;/goal&gt;
						&lt;/goals&gt;
					&lt;/execution&gt;
					&lt;execution&gt;
						&lt;id&gt;default-check&lt;/id&gt;
						&lt;goals&gt;
							&lt;goal&gt;check&lt;/goal&gt;
						&lt;/goals&gt;
					&lt;/execution&gt;
				&lt;/executions&gt;
				&lt;configuration&gt;
					&lt;dataFile&gt;target/jacoco.exec&lt;/dataFile&gt;
					&lt;outputDirectory&gt;/target/jacoco&lt;/outputDirectory&gt;
				&lt;/configuration&gt;
			&lt;/plugin&gt;

</details>


huangapple
  • 本文由 发表于 2020年5月5日 13:45:48
  • 转载请务必保留本文链接:https://java.coder-hub.com/61606523.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定