运行junits和的Cobertura使用Maven [英] running junits and cobertura with maven

查看:207
本文介绍了运行junits和的Cobertura使用Maven的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



   在我们的项目中,我们同时运行junits和的Cobertura使用maven。我现在面临的问题是,


In our project, we run both junits and cobertura using maven. The problem I am facing is that,


  1. JUnit测试案例再次用于生成的Cobertura覆盖报告运行两次,罐子创建过程之前一次,然后。当运行的Cobertura和junits蚂蚁,我们运行junits只有一次,因为用的Cobertura一起junits运行。有可配置与行家上述情况的一种方式。我知道我们可以用maven.test.skip的属性跳过junits。但是,当我这样做,我不能看到junit的XML和HTML文件报告。

  2. 此外,在行家如何junits配置在批处理运行或水货?

谢谢!

推荐答案

虽然我不能找到确切的页面了,我最近读的,为什么运行测试两次被认为是一个好主意的讨论。列举的主要问题是围绕在你测试的准确性的Cobertura字节code改变的影响。在某些情况下,你的code执行时间可能很重要,字节code改变可能会导致在的JUnit测试失败只在的Cobertura,反之亦然运行时通过。出于这个原因,有人建议,测试被允许执行两次。大多数举的例子是周围多线程的行为,但我想,可能有其他病例均字节code可以改变您在测试中引起的问题。具有测试执行两种方式为您提供基准结果,也减少了对大雁追逐送你,如果cobertura在实际上改变试验成功的机会。

While I cannot find the exact page anymore, I recently read a discussion of why running the tests twice is considered a good idea. The key issues cited were around the effects of the Cobertura byte code alteration on the accuracy of your tests. In certain cases the timing of your code execution might be important, the byte code alteration can cause tests that fail in JUnit to pass when run only in Cobertura and vice versa. For this reason, it was recommended that the tests be allowed to execute twice. Most of the examples cited were around multi-threaded behaviors, but I imagine that there could be other cases were the byte code alteration can cause issues in your tests. Having the tests execute both ways provides you with baseline results and also reduces the chances of sending you on a wild goose chase if Cobertura is in fact altering test success.

这篇关于运行junits和的Cobertura使用Maven的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆