title: how to set once After annotated method for all steps in Cucumber-JVM
body: <p>I use Cucumber-JVM and I'm trying to take screenshot after every step (if there is a failure). The problem is that I do not know how to set methods that will be executed before and after every step.</p>
  
  <p>I've used <a href="https://github.com/cucumber/cucumber-java-skeleton" rel="nofollow">https://github.com/cucumber/cucumber-java-skeleton</a> as a reference. I added to runner <a href="https://github.com/cucumber/cucumber-java-skeleton/blob/master/src/test/java/skeleton/RunCukesTest.java" rel="nofollow">https://github.com/cucumber/cucumber-java-skeleton/blob/master/src/test/java/skeleton/RunCukesTest.java</a> BeforeClass and AfterClass (JUnit adnotations) and methods that provide me start and stop of webrdiver (before and after every scenario). I know I can use Before/After annotations (Cucumber ones), but methods with those annotation must be placed in the same class that contains step definitions. The problem is that I have plenty of classes with steps, so I do not want to put those annotated methods in every step class, I need to define them once.</p>
  
  <p>Please, tell me how to do it.</p>
  
  <p>[edit]</p>
  
  <p>Here is my Runner</p>
  
  <pre><code>package example;
  
  
  
  import cucumber.api.CucumberOptions;
  import cucumber.api.junit.Cucumber;
  
  import org.junit.AfterClass;
  import org.junit.BeforeClass;
  import org.junit.runner.RunWith;
  
  
  
  @RunWith(Cucumber.class)
      @CucumberOptions(
          features = "src/test/resources/"
      )
  public class TodoTest {
  
  
      @BeforeClass
      public static void beforeClass() {
  
          System.setProperty("browser", "chrome");
  
  
          System.setProperty("remote", "http://localhost:4444/wd/hub");
  
      }
  
      @AfterClass
      public static void afterClass() {
  
      }
  
  }
  </code></pre>
  
  <p>I need to define methods that will be executed before and after every step in whole project similarly like those methods for scenarios.</p>