To get code coverage with Arquillian we often use jacoco because:
- there is an arquillian extension 🙂
- cobertura, emma…doesn’t work
This is generally true but if you try to use jacoco with OpenEJB embedded Arquillian adapter (this note applies to OpenWebBeans adapter too) it will fail. Why? Simply because this adapter is not a standard one for Arquillian since it is embedded, the JVM is shared between the client and the server…You can remove the jacoco extension and use the jacoco maven plugin/javaagent…but there is easier.
Yes that’s embedded so you can use what you want: cobertura (or Emma) works!
Note on using cobertura in an EJB container: cobertura instruments classes adding an interface. It means if you have a @Local EJB it will magically implement two interfaces (your business one and the Cobertura one). From a spec point of view the deployment will fail. The workaround is to specify as @Local parameter the business interface the bean implements: @Local(MyBusiness.class). In the same idea, @LocalBean becomes mandatory with cobertura (it is not otherwise).