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

Not recognizing step definition in Scenario Outline #40

Open
tottinge opened this issue Dec 5, 2014 · 11 comments
Open

Not recognizing step definition in Scenario Outline #40

tottinge opened this issue Dec 5, 2014 · 11 comments
Labels
Issue A defect or bug which renders one or more features unusable under certain circumstances Stale Probably not relevant anymore and to be closed

Comments

@tottinge
Copy link

tottinge commented Dec 5, 2014

While natural seems to do a great job with the step definition in the flows (seen above in pic), in the scenario outline, it doesn't seem to find the regex. Is it confused by the placeholders not being digits?

screenshot 2014-12-05 10 46 06

@rlogiacco
Copy link
Owner

Nice spotted! I believe it has to do with the way step to stepdefs matching is executed.

@rlogiacco rlogiacco added the Issue A defect or bug which renders one or more features unusable under certain circumstances label Dec 6, 2014
@rlogiacco
Copy link
Owner

Duplicate of #31

@rlogiacco rlogiacco marked this as a duplicate of #31 May 27, 2020
@drkstr101
Copy link
Contributor

Flagging for review in next.

@github-actions
Copy link

This issue has not been updated for a while: marking it as stale.

@github-actions github-actions bot added the Stale Probably not relevant anymore and to be closed label Jul 30, 2020
@github-actions github-actions bot closed this as completed Aug 6, 2020
@rlogiacco rlogiacco reopened this Aug 7, 2020
@drkstr101
Copy link
Contributor

Hmm, this could be tricky. We may have to pull values from the parsed Table data to know how to match the tokens in the step definition.

@rlogiacco
Copy link
Owner

I believe we have also a visualization problem: what should we do when the first three rows match but the fourth doesn't? How to pinpoint where the problem is? Not to mention the performance degradation...

We can aim at a compromise: replace any reference to the placeholders in the step with a fixed value, let's say an underscore, then the step defs must be altered to include this marker char, like "I push [0-9_]+"

@drkstr101
Copy link
Contributor

drkstr101 commented Sep 17, 2020

What if we maintain a cache of TableRow -> description transformations, where description contains the tokenized string replacements. Then CucumberValidator could inject a service in the same fassion os IStepMatcher, but for the purposes of validating intances of Example. In this case would we not issue a warning if there are multiple valid matches, or is this an incorrct assumption about the cardinality of table data to step definitions?

Of course there would need to be a bit of work done at the grammer level, and, for example, providing an IValueConverterService implementation which canparse the table data from raw strings. I think the path is at least reachable though, no?

@rlogiacco
Copy link
Owner

When such entries are evicted from this cache and how do you identify which entries should be removed? You need to also store the source file and evict all entries in the file whenever that file is saved and rebuild that part of the cache... Then your stepmatcher must inspect the cache using the current file as an index....

The step matching is not blazing fast and it is doing at most one match per step, with this approach a table with 100 examples will produce match attempts x 100

@drkstr101
Copy link
Contributor

Ah yes good point, I can see how this could get unwieldy.

@drkstr101
Copy link
Contributor

What if we simply parse the first row (after the header), then make it clear in the warning message what description was used to validate the step definition. Then we can move the step validation check up to AbstractScenario, while branching on ScenarioOutline as a special case.

IMHO this would be more user friendly than requiring changes to the step definitions to compensate for the editor.

@rlogiacco
Copy link
Owner

Yes, I agree with your suggestion: we only try to match the first row of the first table (multiple examples at play!) and CTRL+click brings you to the stepdef we used for matching.

This is a much better compromise than what I was suggesting. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue A defect or bug which renders one or more features unusable under certain circumstances Stale Probably not relevant anymore and to be closed
Projects
None yet
Development

No branches or pull requests

3 participants