title: Save State with Parallel cucumber tests
body: <p>We're using Cucumber/Guice to run UI tests in Java, and several step definition files spread out over the place.</p>
  
  <p>My question is where is state maintained? If I wanted to run two separate tests with two separate runners, how the step defs classes treated? Is one created for each scenario? each feature? Or are they shared across instances?</p>
  
  <p>For instance, would this ever be a problem? Would the following step-def be not thread safe?</p>
  
  <pre><code>public class StepDef  {
  
    private Properties props;
    private int num;
  
    @Inject
    public StepDef(Properties props) {
       this.props = props;
    }
  
  
    @Given("^the digit (\d)$")
    public void the_digit(int num) {
      this.num = num;
    }
  
  
    @When("^it is multiplied by 5$")
    public void it_is_multiplied_by_5() {
      this.num *= 5;
    }
  
    @Then("^the result is (\d)$")
    public void the_result_is(int result) {
      assertEqual(result, this.num);
    }
  }
  </code></pre>