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

is there a way to go to step definition directly from feature file? #99

Open
dimonze opened this issue Apr 15, 2020 · 5 comments
Open
Labels
Discussion Ongoing discussion, gathering thoughts

Comments

@dimonze
Copy link

dimonze commented Apr 15, 2020

is there a way to go to step definition directly from feature file?
Like by pressing F12

@ttutisani
Copy link
Owner

No, there is no such way by using Xunit.Gherkin.Quick alone. F12 or something of that sort would require IDE integration via extension or something of that sort.

I will keep this issue open to see if somebody has a suggestion on how to do that.

@ttutisani ttutisani added the Discussion Ongoing discussion, gathering thoughts label Apr 15, 2020
@dimonze
Copy link
Author

dimonze commented Apr 15, 2020

Thank you for super fast answer, looking forward for any suggestions

@csurfleet
Copy link
Collaborator

I've been looking at issues around this, I've been trying to create some Rosyln Analysers for things like feature files missing/not matching the FeatureFile attribute, to give us red squiggles in the code. The issue is that the content files are not included in the roslyn syntax tree so I can't load them to do the checks.

My thought at the moment is that we could somehow cause a parsed set of feature files to be added to Roslyn's syntax tree at compile time, which we could then access through an Analyser. I'm not sure this is even possible yet, but if I can close that loop then it'll be a simple to add warnings/code fixes when a feature file doesn't match the implementing c# - you'd see warnings in your build result.

I know even this doesn't add the click-through from the feature file itself (I don't think that will be possible without adding a full extension) but it would definitely tighten up that link between text and code.

This is the creating Analyzer stuff from M$ I've been referring to. So far the only useful one I've created shows a warning if a concrete Feature class doesn't have a FeatureFile attribute but I'm sure we can do better :)
https://devblogs.microsoft.com/dotnet/how-to-write-a-roslyn-analyzer/

@ttutisani
Copy link
Owner

ttutisani commented May 8, 2020

Related to the last response from @csurfleet:
Also note that there is now a way to handle not-implemented features, which can result in warnings or errors if you add @ignore tags: https://github.com/ttutisani/Xunit.Gherkin.Quick/blob/master/docs/handle-not-implemented-feature-files.md

This way, the test results can show you what is missing implementation.

@JornWildt
Copy link
Contributor

JornWildt commented Nov 10, 2021

Using the cucumberautocomplete extension (https://github.com/alexkrechik/VSCucumberAutoComplete) in VS Code actually allows you to goto definition. That extension scans text/source files (not assemblies) for patterns like "Given(...)" and assumes that defines steps with the text "..." in them. Once it has matched a step in the feature file it relates it to the line of the step-definition file (C# code) and allows you to jump to that definition.

The extension itself knows nothing about implementation languages - it simply scans source files for Gherkin-like patterns (with all the issues such an over simplification implies).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Discussion Ongoing discussion, gathering thoughts
Projects
None yet
Development

No branches or pull requests

4 participants