Arquillian integration test code coverage issue with Jacoco

浪尽此生 提交于 2019-12-02 04:16:25

I found your solution by asking the JaCoCo dev's (here). It appears to be related to TestNG. If you add the TestNG library to your Arquillian container, your coverage should be fixed. A modified example of yours is shown below.

@Deployment
public static WebArchive createDeployment() throws IOException {
    PomEquippedResolveStage pomEquippedResolveStage = Maven.resolver().loadPomFromFile("pom.xml");

    File[] externalLibs = pomEquippedResolveStage.resolve(
            "org.testng:testng"
    ).withTransitivity().asFile();

    WebArchive webArchive = ShrinkWrap.create(WebArchive.class, "test.war")
            .addClass(EmpService.class)
            .addAsLibraries(externalLibs)
            .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
    System.out.println(webArchive.toString(true));
    return webArchive;
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!