目前我使用@BootstrapWith注释与自定义类一起使用,它只是简单地设置了一些在测试中使用的系统属性。但是(据我所知)这些属性被每个实例TestContextManager来测试和TestContext都会用它时设置:Spring:@BootstrapWith用于ApplicationContext
@BootstrapWith是用于配置 了Spring TestContext框架是怎样的一类级别注解自举
有没有什么办法的ApplicationContext开始前一次设置属性?
编辑:
我不能用@RunWith(SpringJUnit4ClassRunner.class)
由于参数的测试,这需要@RunWith(Parameterized.class)
。我使用SpringClassRule
和SpringMethodRule
而不是
此外,我运行不仅参数化测试,但也运行普通测试。因此,我不能简单地延长Parameterized
亚军
你的意思' System.getProperties()'? –
@MaciejDobrowolski启动ApplicationContext之前的System.setProperty() – Anton
您是否必须全局设置属性,还是每个测试套件的属性都不相同? –