tursu.service.compiler

Gherkin scenario compiler.

Module Contents

Classes

GherkinCompiler

Gherkin compiler.

GherkinIterator

Traverse the gherking feature document to emit gherkin objects. Keep the stack while traversing.

API

class tursu.service.compiler.GherkinCompiler(doc: tursu.domain.model.gherkin.GherkinDocument, registry: tursu.runtime.registry.Tursu, package_name: str)

Gherkin compiler.

Parameters:
  • doc – the gherkin file to compile.

  • registry – the tursu registry where steps are already loaded.

  • package_name – the parent module of the doc.

Initialization

to_module() tursu.domain.model.testmod.TestModule

Get the compiled module.

class tursu.service.compiler.GherkinIterator(doc: tursu.domain.model.gherkin.GherkinDocument)

Traverse the gherking feature document to emit gherkin objects. Keep the stack while traversing.

Parameters:

doc – the document to iterate.

Initialization

emit() collections.abc.Iterator[Any]

Python iterator that emit the stack.

emit_feature(feature: tursu.domain.model.gherkin.GherkinFeature) collections.abc.Iterator[Any]

Helper to traverse feature.

Parameters:

feature – Gherkin feature to traverse.

emit_feature_from_enveloppe(enveloppe: collections.abc.Sequence[tursu.domain.model.gherkin.GherkinEnvelope]) collections.abc.Iterator[Any]

Helper to traverse Background, Scenario and Rule keywords from the scenario.

Parameters:

enveloppe – Gherkin envelope that wrap the proper object to emit.

emit_scenario(scenario: tursu.domain.model.gherkin.GherkinScenario | tursu.domain.model.gherkin.GherkinScenarioOutline) collections.abc.Iterator[Any]

Helper to traverse scenario.

Parameters:

feature – Gherkin scenario or scenario outline to traverse.