java jumblemutations 测试框架可能出现的类加载器问题
jumble 突变测试框架(http://jumble.sourceforge.net/)
这个问题是关于我正在尝试的 搞乱我的工作项目。 我已经在这个项目之一的类上运行了 jumble ,它对某些类执行了突变,但对于其他一些类,它告诉
“测试类已损坏”
尽管我使用 ant 任务运行这些测试类并且它们运行正常,但
。我试图知道出了什么问题,并开始在 eclipse 上以调试模式运行 jumble,为 jumble 报告其测试被破坏的每个类运行 jumble。 当我调试这些类时,我进入 junit 类 TestResult 的实例字段,这样我就可以看到 jumble 运行测试类时 junit 报告的错误和失败的描述,因为 jumble 告诉我“测试类已损坏”,但它没有告诉我为什么它说测试类损坏了,所以我需要调试才能知道发生了什么。我观察到的问题和错误详细信息是由于 jumble 测试失败而导致的,如下所示:(
由于我工作的公司的法律限制,我无法发布某些代码片段,但我会尽力做到这一点)我可以做更多的解释)
对于“Forwarder”类,我在调试模式下运行 jumble 并顺利运行并使突变完美。这是最令我惊讶的情况,因为当与 ant 任务 jumble 一起运行时报告我“测试类已损坏”,但在 Eclipse 的调试模式下运行正常。
对于 Action 类和许多其他类,在调试模式下,运行测试类并检查错误描述时会发生错误,错误是
java.lang.ClassNotFoundException:org.junit.rules.ExpectedException。
我在 junit jar 上有这个类,它的路径可用于 eclipse 调试模式和 ant 任务。 另外,这个类位于 selenium 框架的 jar 中及其依赖项 我认为类加载器可能无法决定要加载哪个版本的类。但我不确定。
对于类模块,我做了同样的事情:当测试由 jumble 运行并完成执行时,检查 TestResult junit 类上可用的错误消息。对于这门课我得到:
java.lang.LinkageError:加载约束冲突:加载程序“com/reeltwo/jumble/mutation/MutatingClassLoader@5b8d5b8d”先前启动了由加载程序“sun/misc”定义的名为“org/hamcrest/Description”的不同类型的加载/Launcher$AppClassLoader@7fce7fce"
这个错误让我感到惊讶。这让我觉得 Jumble 有它自己的类加载器,也许它可能是我一些麻烦的根源。
我真的很感激任何形式的帮助, 马科斯
This question is regarding the jumble mutation testing framework (http://jumble.sourceforge.net/)
i am trying to get jumble into the projects i work on my job.
i've run jumble on the classes of one of this projects and it performs the mutations on some classes but for some others it tells
"test class is broken"
despite i run those test classes with an ant task and they run ok.
I've trying to know what is going wrong and started to run jumble in debug mode on eclipse for each one of the classes that jumble reported their tests to be broken.
When i debug these classes, i get into junit class TestResult's instance fields so i can see the description of the errors and failures that junit reports when jumble run the test class, because jumble tells me "tests class is broken" but it doesn't tell why it says the tests class brokes so i need to debug to know what is happening. The issues and error details i've observed that are the result of the failed tests jumble does are some of the followings:
(I cannot post certain pieces of code due to legal restrictions of the company i work for, but i will try to be the more explanatory that i can)
For the class "Forwarder" i run jumble in debug mode and runs smoothly and makes the mutations perfectly. This is the case that surprises me the most, because this when run with the ant task jumble reports me "test class is broken", but in debug mode in eclipse runs ok.
For the class Action, and many others, in the debug mode an error occurs when the test class are run and when inspected the errors descriptions, the error is
java.lang.ClassNotFoundException: org.junit.rules.ExpectedException.
I have that class on the junit jar and it's path is available for the eclipse debug mode and for the ant task.
Also, this class is in a jar of the selenium framework with its dependencies
I pressume that it could be that the class loader can't decide what version of the class to load. But i'm not sure.
For the class Module, i do the same thing: inspect the error message that is available on the TestResult junit class when the tests is run by jumble and finishes executing. For this class i get:
java.lang.LinkageError: loading constraint violation: loader "com/reeltwo/jumble/mutation/MutatingClassLoader@5b8d5b8d" previously initiated loading for a different type with name "org/hamcrest/Description" defined by loader "sun/misc/Launcher$AppClassLoader@7fce7fce"
This error got me astonished. It makes me think that Jumble has its own class loader and maybe it somehow can be the source of some of my troubles.
I really will appreciate any kind of help,
Marcos
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Jumble 使用自定义类加载器来插入突变,这可能是导致某些问题的原因。
它还嵌入了自己的 junit 版本,这可能是导致 classnotfound 异常的原因。如果没有更多信息,很难确定。
您可以尝试通过 Jumble 邮件列表询问开发人员,或者尝试一下 PIT http://pitest.org。
PIT 使用检测 API 而不是使用类加载器插入突变,不嵌入 JUnit,并且通常要快得多。我写的,所以可能非常有偏见。
Jumble uses a custom classloader to insert mutations, which may be the cause of some of your problems.
It also embeds its own version of junit which might be the cause of your classnotfound exceptions. Without a lot more information it's difficult to say for sure.
You could try asking the developers via the Jumble mailing list, or alternatively give PIT a try instead http://pitest.org.
PIT inserts mutations using the instrumentation API instead of using classloaders, does not embed JUnit and is generally a lot faster. I wrote it so am probably very biased however.