Skip to content

feat: map Gherkin scenarios to SVCs from tags in .feature files #486

Open

Description

@jimisola

Problem description

For Gherkin-based tests (Cucumber, Karate), the link between an SVC and a test result has to be written by hand. There is no annotation processor for .feature files, so annotations.yml must list every SVC with a fullyQualifiedName that matches what the test engine happens to write into the JUnit XML.

That name is not obvious and differs per engine:

  • Cucumber on the JUnit Platform writes the feature file's classpath path as classname (for example feature_classpath_features/orders.feature) and the scenario title as name. The Feature: title is not used.
  • Karate writes names like [1.1:23] Scenario title, which reqstool already parses.

To make the default JUnit rule pick up a Cucumber scenario, the SVC id has to be the first word of the scenario title (Scenario: SVC_CORE_0001 orders over the limit are rejected), and the hand-written entry must match the engine's classname exactly. A wrong guess silently shows the SVC as "automated test missing".

Desired solution

Let reqstool read SVC tags from .feature files and build the test annotations itself:

@SVC_CORE_0001
Scenario: orders over the limit are rejected

For example, a new resource in reqstool_config.yml:

resources:
  feature_files:
    - ../../src/test/resources/features/**/*.feature

reqstool would map each tagged scenario to the test name its engine writes (Cucumber and Karate formats), so annotations.yml is no longer needed for these tests and scenario titles stay free text. Scenario Outline rows would count as results of the same SVC.

Alternatives considered

  • Keep the SVC id as the first word of the scenario title and write annotations.yml by hand: works, but is fragile and easy to get wrong.
  • Convert Gherkin tests to JUnit and use @SVCs: the best fit where possible, but not always an option.

Additional context

Related: #92 (Karate tests not found).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions