reqnroll / Reqnroll

Open-source Cucumber-style BDD test automation framework for .NET.
https://reqnroll.net
BSD 3-Clause "New" or "Revised" License
302 stars 33 forks source link

missing reg expression for arguments in generated step #173

Closed Santjo closed 3 weeks ago

Santjo commented 3 weeks ago

Reqnroll Version

Visual Stusdio 2022 Extension, version 2024.2.93

Which test runner are you using?

NUnit

Test Runner Version Number

?

.NET Implementation

.NET Framework 4.6.2 or later

Test Execution Method

Visual Studio Test Explorer

Content of reqnroll.json configuration file

No response

Issue Description

Unexpectly the generated step description does not include a regexpression such '(\d+)' for related step argument but {int}

    [Given("{int} alerts were triggered")]
    public void GivenAlertsWereTriggered(int p0)
    {
        throw new PendingStepException();
    }

Steps to Reproduce

Open feature file Add new Step with arguments in feature Select the new step which needs to generate th step definition Right click on the step and select "Define Steps ..."from menu Follow code is generated [Given({int} alerts were triggered")] public void GivenAlertsWereTriggered(int p0) { throw new PendingStepException(); }

Link to Repro Project

No response

gasparnagy commented 3 weeks ago

This is the expected behavior. The {int} placeholder is a marker in the Cucumber Expressions format that we support in addition to regular expressions. See https://docs.reqnroll.net/latest/automation/cucumber-expressions.html for details.

You can force generating regular expressions in the snippets by setting the trace/stepDefinitionSkeletonStyle configuration setting to RegexAttribute. See https://docs.reqnroll.net/latest/installation/configuration.html#trace.

Closing this issues as "by design".