Junit Parameterized tests together with Powermock - how?

*爱你&永不变心* 提交于 2019-11-30 06:04:08
Abercrombieande

I had the same issue. Unfortunately it would not let me use a PowerMock Rule due to the JVM I had. Instead of the rule I used RunnerDelegate.

@RunWith(PowerMockRunner.class)
@PowerMockRunnerDelegate(Parameterized.class)
Johan

Yes this works by using the PowerMock Rule available if you use JUnit 4.7+.

You can't use two class runners at once, so you will definitely have to write your own test runner to make that happen.

I don't know anything about Powermock, but after 10 seconds of research, it looks like one solution would be to write a test runner which uses powermock's class loader and runs parameterized tests. If you can figure out how to delegate to the parameterized test runner from within your custom test runner, that might be your best bet.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!