java计算监控覆盖率,java – Arquillian测试覆盖率

我不明白为什么JacocoInegrationTestCase测试的CoverageBean类在报告中不可见.多数民众赞成我所期待的.

有人可以提供示例项目,在Arquillian和测试类上运行1个集成测试,生成测试覆盖率报告吗?

谢谢

@RunWith(Arquillian.class)

public class JacocoInegrationTestCase

{

@Deployment

public static JavaArchive createDeployment() throws Exception

{

return ShrinkWrap.create(JavaArchive.class, "test.jar")

.addClasses(CoverageBean.class, JacocoInegrationTestCase.class);

}

@EJB

private CoverageBean bean;

@Test

public void shouldBeAbleToGenerateSomeTestCoverage() throws Exception

{

Assert.assertNotNull(bean);

bean.test(true);

}

}

@Stateless

public class CoverageBean

{

public void test(Boolean value)

{

String test = "test";

if(value)

{

if(test.length() == 4)

{

long start = System.currentTimeMillis();

test = String.valueOf(start);

}

}

else

{

long start = System.currentTimeMillis();

test = String.valueOf(start);

}

}

}

org.apache.maven.plugins

maven-surefire-plugin

true

integration-tests

test

test

${jbossHome}

false

org/jboss/arquillian/extension/jacoco/test/unit/ *

org/jboss/arquillian/extension/jacoco/test/integration/ *

编辑:

我也试过这个项目(https://github.com/CSchulz/arquillian-jacoco-showcase),看起来非常有意义,但它运行Wildfly的分发版本.但在我的项目中,我们再次运行Arquillian测试安装的JBOSS EAP 6实例,具有数据库连接和其他安全配置.是否有人能够更改它以使用已安装(部署)的JBOSS版本?谢谢

最佳答案 这是适合我的配置.看看它是否对你有所帮助.

org.apache.maven.plugins

maven-surefire-plugin

${version.plugin.maven.surefire}

false

org.jboss.arquillian.junit.Arquillian

org.apache.maven.plugins

maven-failsafe-plugin

${version.plugin.maven.failsafe}

org.jboss.arquillian.junit.Arquillian

false

jbossas-remote-7

integration-test

verify

org.jacoco

jacoco-maven-plugin

${jacoco-plugin.version}

.....

default-prepare-agent

prepare-agent

default-prepare-agent-integration

prepare-agent-integration

${project.build.directory}/jacoco-it.exec

Create Unit Test Report

prepare-package

report

Create Integration Test Report

report-integration

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值