Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem matching steps in the editor #38

Open
JimCooperFromGmailAccount opened this issue Sep 18, 2024 · 8 comments
Open

Problem matching steps in the editor #38

JimCooperFromGmailAccount opened this issue Sep 18, 2024 · 8 comments

Comments

@JimCooperFromGmailAccount

Used Visual Studio

Visual Studio 2022

Are the latest Visual Studio updates installed?

Yes

Content of reqnroll.json (if present)

No response

Issue Description

There is an issue in the editor, where these pairs of step definitions are marked as ambiguous.
So they are marked with a red squiggly line, and also go to declaration/definition doesn't work
The feature.cs files are generated and the tests pass, correctly, with the correct steps being hit.

It seems to be an issue with using enums (here BeDeletedOrNot, Pep, WikiMarkup and OnOrOff are all enums)
It's like the regular expression (.*) is being used in the analysis instead of the possible enum values.

[Then("the batch with ID {int} should {BeDeletedOrNot}")]
[Then("the batch with ID {int} should be updated")]

[Then("the projected value of {Pep}[{int}] should be {double}")]
[Then("{WikiMarkup} should be {OnOrOff}")]

Steps to Reproduce

Create steps using enums, as shown above. The problems are all in the editor. The tests themselves are generated correctly

Link to a project repository that reproduces the issue

No response

@gasparnagy
Copy link
Contributor

gasparnagy commented Sep 19, 2024

To simplify the things, for example the two step defs are marked as ambiguous (although they work fine as test):

[Then("the batch with ID {int} should {BeDeletedOrNot}")]
[Then("the batch with ID {int} should be updated")]

Questions:

  • What are the values in the BeDeletedOrNot enom (or it does not matter)?
  • Do you have a [StepArgumentTransformation] defined for the enums?

It is really strange that it works differently in VS and in test execution, because VS should ask from the runtime what regex the cucumber expression is translated to, so the two should use the same regex at the end... But let's see.

@JimCooperFromGmailAccount
Copy link
Author

@JimCooperFromGmailAccount
Copy link
Author

@JimCooperFromGmailAccount
Copy link
Author

@gasparnagy
Copy link
Contributor

@JimCooperFromGmailAccount Do you have a chance to figure out what makes the difference between the ones that are problematic and the ones that are not? Can you maybe also share the small test project (although I probably cannot check it before Monday).

@JimCooperFromGmailAccount
Copy link
Author

I have a theory that an enum parameter as the first and/or last thing in the step expression is causing the trouble, because those seem to sometimes match as if they were (.*) regexes. If they're in the middle somewhere there is more to differentiate between the steps. The troublesome steps also share some common text.
However, parameter highlighting still sometimes works.
My attachment didn't seem to arrive last time. Hopefully it'll work this time
StepAnalyserBug.zip

@gasparnagy
Copy link
Contributor

Yes, the attachment is downloadable now. I will check it next week.

@JimCooperFromGmailAccount
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants