我已在jacoco.exec文件中捕获了覆盖范围详细信息。它的大小为6Mb。 我需要使用maven生成一个覆盖率报告。 我尝试了下面的
<dependencies>
<dependency>
<groupId>org.jacoco</groupId>
<artifactId>org.jacoco.ant</artifactId>
<version>0.7.0.201403182114</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.6.3.201306030806</version>
<executions>
<!--
Ensures that the code coverage report for integration tests after
integration tests have been run.
-->
<execution>
<id>post-integration-test</id>
<phase>post-integration-test</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<!-- Sets the path to the file which contains the execution data. -->
<dataFile>D:/JaCoCo/jacoco.exec</dataFile>
<!-- Sets the output directory for the code coverage report. -->
<outputDirectory>${project.reporting.outputDirectory}/jacoco-it</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
正在生成零百分比的覆盖率报告。
在测试之前,jacoco.exec文件的大小为零字节,现在它的大小为6MB。 我在pom.xml中缺少什么?
答案 0 :(得分:18)
这是jacoco插件配置。
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.5.10.201208310627</version>
<configuration>
<skip>${maven.test.skip}</skip>
<output>file</output>
<append>true</append>
</configuration>
<executions>
<execution>
<id>jacoco-initialize</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>jacoco-site</id>
<phase>verify</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
maven:test
时,它将生成jacoco.exec文件jacoco:report
时,它会在target / site / jacoco目录下的html文件中生成报告。您可以通过打开index.html 答案 1 :(得分:1)
运行//@version=3
study("my_test",shorttitle="bands",overlay=true)
string VOLA_INDEX = ""
if (ticker == "USOIL")
VOLA_INDEX := "OVX"
if (ticker == "GOLD")
VOLA_INDEX := "GVZ"
if (ticker == "GER30")
VOLA_INDEX := "DV1X"
src = security(ticker,"D",close[1])
vola = security(VOLA_INDEX,"D",close[1])
bands1 = src * vola/100 * sqrt(0.00273972602)
bands3 = src * vola/100 * sqrt(0.00821917808)
upper1 = src + bands1
lower1 = src - bands1
plot( src, title="mean", color=black, style=linebr, linewidth=2, transp=100, trackprice = true,offset=-9999)
plot( upper1, title="upper", color=blue, style=linebr, linewidth=2, transp=40, trackprice = true,offset=-9999)
plot( lower1, title="lower", color=blue, style=linebr, linewidth=2, transp=40, trackprice = true,offset=-9999)
,它将生成覆盖率报告。打开target / site / jacoco / index.html文件以获取图片视图。