jeudi 25 février 2016

Why JBehave maintain data across steps Given/When/Then during a Scenario?

I am trying JBehave and I need to understand why maintains data (instance variables from the steps) across scenarios (testCases -> Given/When/Then).

I mean, is it possible to clear the instance variable maintained during the execution of each scenario (Given/When/Then) without using @BeforeScensario?

Example:

public class GenerateReportSteps {

private String a;
private String b;
private String c;

@BeforeScenario
public void beforeEachScenario() {
    a = null;
    b = null;
    c = null;
}

.. .. }

If I'm not wrong, I understand that each scenario (Given/When/Then) have to be atomic, so the framework JBehave should initialize to null the instance variables before run each scenario per user story.

Thanks.-

Aucun commentaire:

Enregistrer un commentaire