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

Rider cannot find a matching step definition for a Scenario Outline step #194

Closed
aventus13 opened this issue Mar 21, 2023 · 3 comments
Closed
Labels
bug Something isn't working

Comments

@aventus13
Copy link

Problem description

Hello, I'm having the following problem in Rider. Consider the below step:

# Removed for brevity
# ....
And the request contains invalid parameter <ParameterName> set to <Value>
# ....
Examples: 
	| ParameterName    | Value |
	| givenName           |           |

The tests pass correctly, however, the IDE throws the following warning:
image
"Cannot find a matching step definition"

Interestingly, I tried following the recommendation from Specflow documentation and wrapped the arguments with apostrophes. This stops the IDE from complaining about the missing step definition. However, tests start treating the argument names as actual values, and thus my tests fail.

image

I deleted the generated step definition files each time after making an update, thus ensuring that step definitions get regenerated. It's worth noting that the problem only exists in some places. I opened one of the older repos, and the IDE doesn't display the warning.

System specification

JetBrains Rider 2022.3.2
Runtime version: 17.0.5+1-b653.25 amd64
.NET 7

@aventus13 aventus13 changed the title Rider cannot find a matching a step definition for a Scenario Outline step Rider cannot find a matching step definition for a Scenario Outline step Mar 22, 2023
@Socolin
Copy link
Collaborator

Socolin commented Nov 26, 2023

What regex do you use in the pattern ? The current code try to find it by applying the regex to the string with the <> so if you use .+ it should work

[Given("the first number is (.*)")]

will match

Given the first number is <Number1>

Ideally the plugin should replace those with the first value available and try to match this way

@Socolin Socolin added the bug Something isn't working label Nov 27, 2023
@aventus13
Copy link
Author

Hi @Socolin, this is exactly the pattern that I'm using:

[Given("the first number is (.*)")]

I checked other scenarios, played about with it and I think that I came to the bottom of what's causing the issue.

There are cases with multiple steps, each steps referencing a different named value, and some of them work while others don't. All steps use the same pattern, and all have the value referenced at the end of the sentence. The only one that doesn't work has its first value empty- it's the only difference. When I change the first value, e.g. to test, Specflow detects the step definition and can navigate to it.

unnamed

unnamed

unnamed

@Socolin
Copy link
Collaborator

Socolin commented Nov 27, 2023

I found the problem, there was a .Trim() that was removing the last space when, in this case, it should not

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants