【发布时间】:2015-03-22 12:12:03
【问题描述】:
我正在为 Spring 应用程序开发测试。我有几个测试要针对不同的数据运行多次。
我不能使用 JUnit 的 @Parameters,因为必须使用 Parameterized.class 运行测试类才能使其工作,而我必须使用设置模拟 Spring 上下文的 SpringJUnit4ClassRunner.class 运行测试类。 不幸的是,似乎this runner doesn't support processing of the @Parameters annotation。我也看了一下TestContextBootstrapper和TextExecutionListener,但是好像也帮不了我。
有没有办法为不同的输入数据多次运行 Spring 应用程序的测试?
我需要类似于 TestNG 的 @Test(dataProvider=) @DataProvider couple 或 @Factory(dataProvider = ) @DataProvider couple。
提前致谢。
【问题讨论】:
标签: java spring spring-mvc junit junit4