SpecFlowOSS / SpecFlow.Rider

SpecFlow support for both ReSharper and Rider
MIT License
30 stars 18 forks source link

Adding support for Cucumber Expression #184

Open DerAlbertCom opened 1 year ago

DerAlbertCom commented 1 year ago

With SpecFlow 4 Cucumber Expression will be supported out of the box.

https://docs.specflow.org/projects/specflow/en/latest/Bindings/Cucumber-Expressions.html

So it would be nice if also Rider can support Cucumber Expressions

I'm willing to help, but have no clue where to start.

SabotageAndi commented 1 year ago

@Socolin could you help @DerAlbertCom and give him a hint?

Socolin commented 1 year ago

Hello,

I don't have much time so all I'm writting is from my memory, so check the code before :) If you have more precise questions I'll take a look more in depth, You can also ask me question on discord (you can find me in the specflow discord)

You can try by looking at the internal doc.

https://github.com/SpecFlowOSS/SpecFlow.Rider/blob/master/doc/how-it-works.md

You need first to understand the caches, SpecflowStepsDefinitionsCache and SpecflowStepsUsagesCache it's pretty simple, we scan all the code and we keep a list of steps definition and steps in .features.

Then you need to understand the Reference part https://github.com/SpecFlowOSS/SpecFlow.Rider/blob/master/doc/how-it-works.md#reference

Then I think you should be able to edit the code here:

https://github.com/SpecFlowOSS/SpecFlow.Rider/blob/master/src/dotnet/ReSharperPlugin.SpecflowRiderPlugin/References/SpecflowStepDeclarationReference.cs#L48

I think you could make SpecflowStepInfo abstract and create 2 class SpecflowRegexStepInfo and SpecflowCucumberExpressionStepInfo, move all the regex related stuff into SpecflowRegexStepInfo and add what you need into the SpecflowCucumberExpressionStepInfo

And after that you could have code like if (stepInfo is SpecflowRegexStepInfo) {} ... else if (stepInfo is SpecflowCucumberExpressionStepInfo) where needed.

To keep this reviewable and simple, I would recommend to do a first commit to split SpecflowStepInfo into SpecflowStepInfo and SpecflowRegexStepInfo and then add in another commit SpecflowCucumberExpressionStepInfo with the logic to support this.

Socolin commented 1 year ago

I forgot, for the completion I would like to rewrite some code before adding more stuff into it, we can take a look at it once the reference are workings

DerAlbertCom commented 1 year ago

Thanks for the write-up. But was unable to get the Tests running on my machine (macOS, with some Mono 6.12 Runtime is installed), will check it again this week on a Windows Machine, everything seems to be Full Framework.

image

Tried to switch to net6.0, but this won’t compile. I think this will work better by developing on Windows.

I've seen the remark for tests on macOS in the Directory.build.props

image

But this also not really helps.

Socolin commented 1 year ago

The tests only run on windows, this is a limitation of resharper SDK (resharper run using full framework for visual studio and the test framework use mono on Linux / MacOs and some stuff don't works) Let's hope this change soon.

Since latest EAP we can target net6 for the plugin, but the test SDK is not yet compatible with net6.

evho commented 1 year ago

Hello,

I am willing to help here but I am new to Rider plugin development. I do have a windows system for development though.

At the moment I am stuck at building the plugin (gradlew :build):

image

NB. To get this far I had to switch the product version from 2022.3-EAP07 to EAP09.

Any help is appreciated.

Socolin commented 1 year ago

Hello,

I am willing to help here but I am new to Rider plugin development. I do have a windows system for development though.

At the moment I am stuck at building the plugin (gradlew :build):

image

NB. To get this far I had to switch the product version from 2022.3-EAP07 to EAP09.

Any help is appreciated.

Hello,

The EAP 8 and EAP 9 have a bug and cannot be built (bug on JetBrains side). Also there are few bugs with the current EAPs, so I would recommend you to start on the stable version (Create a branch from commit 1bf508e1449c8c2a20c93d2ae71cb9222fbc343e)

FredericVaugeoisFlo commented 1 year ago

Hi! Is there any update on this feature?

galborn commented 8 months ago

Hey seems like a valuable feature, any updates :) ?