英文:
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
<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>
</details>
专注分享java语言的经验与见解,让所有开发者获益!
评论