Apply '@Rule' after each '@Test' and before each '@After' in JUnit

后端 未结 3 1074
隐瞒了意图╮
隐瞒了意图╮ 2020-12-06 05:10

I have a test suite where I am logging out of the system in @After and closing the browser in @AfterClass. I am trying to use @Rule to

3条回答
  •  無奈伤痛
    2020-12-06 05:37

    What about using the ExternalResource rule ?
    Looks like you it can give you enough flexibility to what you need.
    And if this is not exactly what you need, take a look at the source code of external resource.
    It's quite understandble how to implement a rule for example that will work only after the test invocation.

提交回复
热议问题