单元测试 – 在同一个JUnit测试中使用Arquillian和PowerMock
我想在同一个JUnit 4测试中使用Arquillian和PowerMock的功能.
问题是两个产品都是JUnit Runners,它应该与@RunWith一起使用,这不可能在同一个测试类上使用多个@RunWith,或者将多个Runners类放在同一个@RunWith注释中. 你知道有什么办法吗 解决方法
如果您使用
PowerMockRule(这是
TestRule),则可以使用PowerMock而不使用转轮.从PowerMockRule:
@RunWith(Arquillian.class); public class MyTest { @Rule PowerMockRule rule = new PowerMockRule(); // Tests goes here ... } 另请参阅Junit Parameterized tests together with Powermock – how?的答案和PowerMock谷歌组中的以下线程:Using PowerMock without the RunWith?. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |