Hi Evgeny,
Thank you for your help.
You're right, I need to give you more details.
In fact, I'm launching Integration Tests from a pipeline:
1. These tests are Implemented with RestAssured
2. and RestAssured uses a JBoss server (installed in a docker).
My pipeline uses maven and the failsafe plugin to run the IT tests.
- part of my pom file:
* <plugin>*
* <artifactId>maven-failsafe-plugin</artifactId>*
* <executions>*
* <execution>*
* <id>integration-tests</id>*
* <goals>*
* <goal>integration-test</goal>*
* <goal>verify</goal>*
* </goals>*
* <configuration>*
* <includes>*
* <include>**/*IT.java</include>*
* </includes>*
* <skipTests>false</skipTests>*
* </configuration>*
* </execution>*
* </executions>*
* </plugin>*
* <plugin>*
* <groupId>org.jacoco</groupId>*
* <artifactId>jacoco-maven-plugin</artifactId>*
* <version>${version.jacoco}</version>*
* <executions>*
* <execution>*
* <id>agent-for-it</id>*
* <goals>*
* <goal>prepare-agent-integration</goal>*
* </goals>*
* </execution>*
* <execution>*
* <id>report-it</id>*
* <phase>verify</phase>*
* <goals>*
* <goal>report-integration</goal>*
* </goals>*
* </execution>*
* </executions>*
* </plugin>*
The Jacoco agent is attached on the Jboss JVM.
see: ps -aef result:
* /opt/java/bin/java -D[Standalone] -XX:+UseCompressedOops -verbose:gc
-Xloggc:/home/jboss/log/gc.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps
-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=3M
-XX:-TraceClassUnloading *
* -server -Djava.net.preferIPv4Stack=true -XX:MaxRAMFraction=2
-Djava.awt.headless=true *
* -javaagent:./opt/jboss-eap/jacocoagent.jar=destfile=/home/jacoco.exec *
* -Dorg.jboss.boot.log.file=/home/jboss/log/server.log
-Dlogging.configuration=file:/opt/jboss-eap/standalone/configuration/logging.properties
-jar /opt/jboss-eap/jboss-modules.jar *
* -mp /opt/jboss-eap/modules -jaxpmodule javax.xml.jaxp-provider
org.jboss.as.standalone *
* -Djboss.home.dir=/opt/jboss-eap
-Djboss.server.base.dir=/opt/jboss-eap/standalone
-Djboss.server.log.dir=/home/jboss/log/ -Djboss.server.temp.dir=/tmp -b
0.0.0.0 -bmanagement 0.0.0.0 -Ddocker.jboss.log.level=INFO*
My application is deployed and all tests are success.
But the coverage remains at 0%, and when I check the session view, I don't
see my classes.
[image: session.PNG]
[image: coverage.PNG]
If, for Marc and you, it's due to the fact the agent is not in the right
JVM, to be honest I dont know where to put it :(
I'm sure I'm missing something, because your example is clear and work fine.
Thanks
Best regards
Mickael
Le mercredi 3 février 2021 à 11:57:35 UTC+1, Evgeny Mandrikov a écrit :
> On Tuesday, February 2, 2021 at 2:04:22 PM UTC+1 Mike BO wrote:
>
>> Hi Marc, and thank you for your feedback,
>>
>> Yes I have generated a HTML report, but I don't see my classes :( . Only
>> internal jboss classes).
>>
>
> Hi,
>
> Absence of classes in Session page of HTML report means that execution of
> these classes was not observed in JVM with agent that generated exec file.
>
>
>> I must have forgotten something, but I don't know what.
>>
>
> One can try to ask questions like - are you sure that agent was used in
> the right JVM?
>
> But IMO highly unlikely that someone will be able to blindly guess what is
> wrong in your case, unless you provide complete example that others can try.
>
> I tried to use JaCoCo for simple application in WildFly (formerly known as
> JBoss) as described below and did not faced problem like yours
>
> downloaded
> https://download.jboss.org/wildfly/21.0.0.Final/wildfly-21.0.0.Final.zip
> and unpacked it into
> /tmp/example/wildfly-21.0.0.Final
>
> downloaded
>
> https://search.maven.org/remotecontent?filepath=org/jacoco/jacoco/0.8.6/jacoco-0.8.6.zip
> and unpacked it into
> /tmp/example/jacoco-0.8.6
>
> downloaded
> https://tomcat.apache.org/tomcat-7.0-doc/appdev/sample/sample.war
> into
> /tmp/example/wildfly-21.0.0.Final/standalone/deployments/
>
> it contains servlet
> mypackage/Hello.class
>
> then I started server with JaCoCo agent as following
> JAVA_OPTS=-javaagent:/tmp/example/jacoco-0.8.6/lib/jacocoagent.jar=destfile=/tmp/example/jacoco.exec
>
> /tmp/example/wildfly-21.0.0.Final/bin/standalone.sh
>
> then visited page in browser to execute servlet
> http://localhost:8080/sample/hello
>
> after that stopped server, so file
> /tmp/example/jacoco.exec
> was generated
>
> generation of report from it
> java -jar /tmp/example/jacoco-0.8.6/lib/jacococli.jar report
> /tmp/example/jacoco.exec --classfiles
> /tmp/example/wildfly-21.0.0.Final/standalone/deployments/sample.war --html
> /tmp/example/report
>
> produces report where
> mypackage/Hello.class
> is present in Sessions page - here is screenshot
>
> [image: sessions.png]
>
> and on page with coverage metrics
>
> [image: report.png]
>
>
> Regards,
> Evgeny
>
>
--
You received this message because you are subscribed to the Google Groups
"JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jacoco/338b0fe9-6d16-4095-8c0b-4445e67391cdn%40googlegroups.com.