Apply '@Rule' after each '@Test' and before each '@After' in JUnit
问题 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 take failed test screenshot using Selenium for every test method. I checked manually that @Rule only runs before every @Before but I want to set it up after @Test and before @After . I couldn't find out simple solution. Any help will be appreciated. public class MorgatgeCalculatorTest { @Before public void before(){ System.out.println("I am before"); }