Skip to content

Using OFT with two valid consecutive tagged gherkin scenarios, only the first scenario is imported; #577

Description

@skyglass

Description

OpenFastTrace 4.9.0 does not import consecutive tagged Gherkin scenarios unless a
Gherkin boundary such as Rule: appears between them.

Rule is optional Gherkin structure. Requiring it for OFT import is undesirable:
in many specifications a Rule would merely repeat the Scenario’s meaning.

The current repository workaround adds a temporary Rule boundary only to a
trace-input copy; checked-in .feature files remain normal Gherkin. After this
bug is fixed, this workaround must no longer be necessary.

Steps to Reproduce

  1. Create a .feature file with two consecutive tagged scenarios:

    Feature: Example
    
    @id:scn~first~1
    # Needs: itest
    Scenario: First scenario
      Given a precondition
    
    @id:scn~second~1
    # Needs: itest
    Scenario: Second scenario
      Given another precondition
    
  2. Run:

    java -jar openfasttrace-4.9.0.jar trace .

  3. Add an integration-test coverage tag for scnsecond1.

Expected behavior

Both scenarios are imported as OFT specification items without requiring a
Rule: element between them. The coverage tag for scnsecond1 resolves.

Environment

  • OFT: 4.9.0
  • OS: macOS 26.6.1
  • Java Version: OpenJDK 21.0.2 Temurin
  • Maven Version: 3.9.10

Additional context

OFT’s Gherkin documentation states that an OFT ID belongs in the contiguous tag
region immediately before a Scenario or Scenario Outline; it does not
require a Rule.

Without the temporary Rule boundary, metadata for the next scenario is not
reopened after the preceding scenario and the later scenario is not imported.

Current workaround:

def _prepare_openfasttrace_input(tmp_path: Path) -> Path:
"""Create an OFT input copy that works around its Gherkin importer defect.

  OFT 4.9.0 documents consecutive tagged scenarios as supported, but its
  released importer only begins metadata parsing again after a Gherkin
  boundary. Add temporary boundaries for tracing only, keeping the checked-in
  specifications idiomatic Gherkin.
  """
  trace_root = tmp_path / "trace-input"
  shutil.copytree(
      PROJECT_ROOT,
      trace_root,
      ignore=shutil.ignore_patterns(
          ".git",
          ".nox",
          ".venv",
          ".pytest_cache",
          "__pycache__",
          "*.pyc",
      ),
  )

  for feature_file in (trace_root / "specs").rglob("*.feature"):
      source = feature_file.read_text()
      feature_file.write_text(
          source.replace(
              "\n@id:",
              "\nRule: OpenFastTrace scenario boundary\n@id:",
          )
      )

  return trace_root

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    Status
    📫 Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions