This year I traveled in a motorhome for the first time, went sailing, played squash, and ran my first 10 kilometers. I visited 7 countries, 13 cities, and met new friends. This year has been so eventful that I decided to gather all the memories in one place, as a keepsake.
Continue reading “2023: Year in review”Author: Anton Kuznetsov
How to collect code coverage data from a remote server
In this article, we find out how to collect coverage data from a remote server. For this aim, we will use WebSphere as a server and Ant as a project builder, but you can use any other servers and builders.
Step 1
Run webserver with JaCoCo agent. For this add JVM flag //-javaagent//:
-javaagent:/opt/jacoco/jacocoagent.jar=output=tcpserver,address=*,port=10001
It needs to have path to jacocoagent.jar which you download from Jacoco site. You can find it in downloaded ZIP in lib folder.
It needs also port number. You can use any free port. This is a port on which Ant Jacoco Plugin will connect to download coverage data.
You can also add flag like this:
-javaagent:/opt/jacoco/jacocoagent.jar=destfile=jacoco.exec,output=file,append=false,classdumpdir=./classdump
but in this case you have to collect report file manually somehow. For our example we use first option.
Step 2
Create target into Ant build script:
<target name="get_data_from_remote_server">
<jacoco:dump address="${server_address}" port="10001" reset="true" append="false" destfile="${some_path}/jacocoResults/jacoco_remote.exec" />
</target>
where //address// — address of remote server, //destfile// — path where you want to save report.
Step 3
Modify building process. In general it should looks like:
- Build app
- Deploy app on server
- Start server
- Run system integration tests
- Collect all test reports
- Shut down server
Useful links
Hello, world!
Let’s code!
public class Blog {
public static void main() {
System.out.println("Hello, World!");
}
}