question about the html code coverage, it seems incorrect

58 views
Skip to first unread message

liangb...@gmail.com

unread,
Jul 5, 2016, 3:52:00 AM7/5/16
to JaCoCo and EclEmma Users
Hello. Marc
I use Jacoco with ant and get a html code coverage report ,but the result seems not correct

liangb...@gmail.com

unread,
Jul 5, 2016, 4:23:09 AM7/5/16
to JaCoCo and EclEmma Users, liangb...@gmail.com
在 2016年7月5日星期二 UTC+8下午3:52:00,liangb...@gmail.com写道:
> Hello. Marc
> I use Jacoco with ant and get a html code coverage report ,but the result seems not correct

I do not know how to add a picture
The question is :
in the code coverage report list page ,I found the code coverage is 90% ,but when linked the detail page ,the source code is not colored and the source code with color is not continues .I saw session link of detail page ,it shows the class name

When I see the source code of html code coverage data ,I found code like this
========================================================================
<span class="nc" id="L103"> String userUuid = tokenService.parseUserUuidFromToken(token);</span>
if (StringUtils.isBlank(userUuid) || phoneRequest == null || StringUtils.isBlank(phoneRequest.getMobilePhone())) {
LOG.error(&quot;credit report login request error. token:{}, phoneRequest:{}&quot;, token, phoneRequest);
throw new RequestInvalidException(AppError.OTHER_HTTP_MESSAGE_NOT_READABLE, token + &quot;:&quot; + phoneRequest);
}
CreditReportStatusResource statusResponse = creditReportService.mobilecode(userUuid, phoneRequest.getMobilePhone());
return statusResponse;
}
=====================================================================
I think this results wyh the html code coverage seems not continues ,but I donot know why is html data is incorrect .

The application is a jar,not war application.And I use ant to compile.
I hava checkout the appliacation
1.the application startup command is :java -jar -Xmx1536m -XX:MaxPermSize=512M -javaagent:/opt/jacocoagent.jar=includes=*,output=tcpserver,port=10003,address=127.0.0.1 -Djava.security.egd=file:/dev/./urandom server-${VERSION}-SNAPSHOT.jar --server.port=9000 --spring.profiles.active=beta ,I hava checked through ps -ef |grep java
2.I checkout my build.xml
<project xmlns:ns0="antlib:org.jacoco.ant" default="rebuild" name="credit-card-server">
<!--Jacoco的安装路径-->
<property name="jacocoantPath" value="/opt/apache-ant-1.9.7/lib/jacocoant.jar"/>

<property name="jacocoResultPath" value="/jacoco/target"/>
<!--最终生成.exec文件的路径,Jacoco就是根据这个文件生成最终的报告的-->
<property name="jacocoexecPath" value="/jacoco/jacoco.exec"/>
<!--生成覆盖率报告的路径-->
<property name="reportfolderPath" value="${jacocoResultPath}/report/"/>
<!--远程tomcat服务的ip地址-->
<property name="server_ip" value="127.0.0.1"/>
<!--前面配置的远程tomcat服务打开的端口,要跟上面配置的一样-->
<property name="server_port" value="10003"/>
<!--源代码路径可以包含多个源代码-->
<property name="source" value="/jacoco/source/credit-card-server/src/main/java/" />
<!--.class文件路径可以包含多个-->
<!--确认-->
<property name="classes" value="/jacoco/classes/credit-card-server"/>


<!--让ant知道去哪儿找Jacoco-->
<taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">
<classpath path="${jacocoantPath}" />
</taskdef>

<!--dump任务:
根据前面配置的ip地址,和端口号,
访问目标tomcat服务,并生成.exec文件。-->

<target name="dump">
<ns0:dump address="${server_ip}" reset="false" destfile="${jacocoexecPath}" port="${server_port}" append="false"/>
</target>

<!--jacoco任务:
根据前面配置的源代码路径和.class文件路径,
根据dump后,生成的.exec文件,生成最终的html覆盖率报告。-->

<target name="report">

<ns0:report>


<executiondata>
<file file="${jacocoexecPath}" />
</executiondata>


<structure name="credit-card-server">
<classfiles>
<fileset dir="${classes}"/>
</classfiles>
<sourcefiles>
<fileset dir="${source}" />
</sourcefiles>
</structure>


<html destdir="${reportfolderPath}" />
<csv destfile="${reportfolderPath}/report.csv" />
<xml destfile="${reportfolderPath}/report.xml" />
</ns0:report>
</target>



</project>
it seems no question

3. the I checked the source code file ,it is the latest ,same with the appliacaion runnning

I think the right code coverage data is continues and when I calls an interface,I use ant dump ,ant report,I can see the code coverage in time


Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages