title: Cucumber: how can you create a BaseSteps class if you can’t use inheritance with Cucumber?
body: <p>Cucumber: how can you create a BaseSteps class if you can’t use inheritance with Cucumber? </p>
  
  <p><strong>Login Steps inherits the CommonSteps class:</strong></p>
  
  <pre><code>    public class LoginSteps extends CommonSteps {
  
      WebDriver driver = getDriver();
  
      @Given("^User navigates to the \"([^\"]*)\" website$")
      public void user_navigates_to_the_website(String url) throws Throwable {
          basePage.loadUrl(url);
      }
  
      @And("^User entered the \"([^\"]*)\" username$")
      public void user_entered_the_username(String username) throws Throwable {
          loginPage.setUsername(username);
      }
  
  
  
  
  
  
  public class CommonSteps  {
      @After
      public void close_browser_window(Scenario scenario) throws Exception {
          if (scenario.isFailed()) {
              scenario.embed(((TakesScreenshot) driver).getScreenshotAs(OutputType.BYTES), "image/png");
          }
      }
  }
  </code></pre>