junit 中是否有 @AfterMethod 的替代方案?
Is there a alternative of @AfterMethod in junit?
我无法在 junit 中使用 @AfterMethod
,因为它属于 testng.Is 在 junit 中有 @AfterMethod
的替代方案。
JUnit 4 使用@Before
and @After
来指示需要在单元测试之前或之后运行 的方法,这实际上是一种方法。
所以直接等同于 @AfterMethod
就是 @After
.
@BeforeClass
and @AfterClass
是before/after整个class.
我无法在 junit 中使用 @AfterMethod
,因为它属于 testng.Is 在 junit 中有 @AfterMethod
的替代方案。
JUnit 4 使用@Before
and @After
来指示需要在单元测试之前或之后运行 的方法,这实际上是一种方法。
所以直接等同于 @AfterMethod
就是 @After
.
@BeforeClass
and @AfterClass
是before/after整个class.