开发者

Which one runs first: @AfterTest or @TestListener?

I have a TestNG program that creates files as part of the test but those files need to be deleted after 开发者_如何学运维the test runs. So I will use an @AfterTest anotation to do this.

The problem is that my TestListener uses these files to generate error reports after every failed test.

Which one runs first, the @AfterTest annotation or the attached Listener?


You could write a simple test application to find the answer you desire. In pseudocode:

someTest() { print "Test was run." }

@AfterTest
afterTest() { print "AfterTest method was run." }

@TestListener
testListener() { print "TestListener method was run." }

Build this and run it; that should help you answer your question.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜