Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我希望使用@BeforeClass 注释运行一个方法两次(或更多)。有没有办法用 TestNG 做到这一点?
喜欢:@Test(invocationCount = 2)?
不,TestNG 中没有这样的规定。
@BeforeClass是一种配置方法,旨在@Test在特定类中的任何方法执行之前只运行一次。
@BeforeClass
@Test
所以没有办法改变它的行为。