Cube Standalone is a mode in Arquillian Cube which instead of deploying a WAR file inside a running Docker container and run the tests inside the container, it starts an already created docker image with WAR file copied inside.
Then test is executed as client, outside the container. Because of this you can run tests against that docker image. The problem is that when running this tests you have no way to get code coverage of business code since it runs inside an already created Docker image.
But from the point of view of Cube we could do some kind of magic to allow run JaCoCo inside the container and then get the results.
The problem is that any idea I get for modifying the deployed WAR file to do Code Coverage Offline finds a problem:
- To get the war file to enrich with JaCoCo I need to run that container to get the war file, and this means that I need to get the war file to client (no problem), modify the war (no problem) copy again inside the container (no problem) but since container was started the war file was already deployed so this means that this is a redeployment of same war file but enriched, and every application service might have different behaviour.
- Use a Dockerfile 1. The problem again is that we cannot get the WAR file without having container up.
- Use Dockerfile 2. Create a Dockerfile based on the image given by user, copy the JaCoCo zip and add in JavaOpts env var the javaagent thing.
It seems that third option might be a candidate to work, but do you have any other approach/idea on how to face the problem?