Converting hundreds of tests from groovy to java

I recently had the opportunity to convert hundreds of tests from Groovy to Java in the OpenTelemetry Java Instrumentation project. Along the way, I wrote some code to track the progress, and started documenting my learnings.

I have published some of my notes in the notes section of this site for anyone interested in converting some tests on their own. I hope you find them useful!

Now for the nerdy stuff, because I love metrics I decided to write a little code to generate some time series metrics for the progress, and then to also do some analysis.

The code for generating the data can be found here: https://github.com/jaydeluca/repo-metrics

Progress tracking (by file count)

The project involved converting code across dozens of different instrumentation modules, and was being tracking with a markdown checklist in the github issue. I wanted to create a visualization in order to see what had been done and what was left to do. I figured one way to do this would be to go through all the files in the project and count the number of test related groovy files and classes.

Java file comparison

After a while, it didn’t feel as useful to include the Java count as the project was growing quickly and all new code was being written in Java. Focusing just on the groovy:

Java file comparison

Analyzing remaining modules

I then wanted to break things down by instrumentation module to get a better picture of the distribution of where the remaining groovy code was.

Remaining modules
KeyValue
spring52
jaxrs37
servlet23
restlet22
couchbase18
aws-sdk17
ratpack16
elasticsearch15
play15
jaxws15
vertx14
mongo10
jdbc8
apache-dubbo-2.77
jaxrs-client5
netty5
apache-httpclient3
opentelemetry-api3
grizzly-2.33
grails-3.03
undertow-1.43
kafka3
internal2
dropwizard2
hibernate1
rediscala-1.81
spymemcached-2.121
twilio-6.61

Conclusion

Since I joined the groovy battle, we have converted over 250 files, with under 300 remaining at the time of this post. Will we finish by the end of 2024? Only time will tell!

UPDATE

This project was completed on January 28, 2025.