dotnetprofessional / LiveDoc

A Living Documentation platform for BDD (Gherkin) specifications.
MIT License
9 stars 2 forks source link

Support passing context to Feature/Scenario/GWT etc #28

Open dotnetprofessional opened 7 years ago

dotnetprofessional commented 7 years ago

Problem

The current design uses variables at the global scope. This can cause issues if trying run in parallel and can make discovery more difficult. This proposal passes the context into the function call.

Proposal

feature("my feature", (context: LiveDocContext) => {}); scenario("my scenario", (context: LiveDocContext) => {}); scenarioOutline("my scenario outline", (context: LiveDocContext) => {}); given("...", (context: LiveDocContext) => {}); when("...", (context: LiveDocContext) => {}); then("...", (context: LiveDocContext) => {}); and("...", (context: LiveDocContext) => {}); but("...", (context: LiveDocContext) => {});

The LiveDocConext would have the schema:

class LiveDocContext {
   feature: FeaturCongtext;
   background: BackgroundContext;
   scenario: ScenarioContext;
   scenarioOutline: ScenarioOutlineContext;
   stepContext: StepContext;
}