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

.feature doesn't work with import from io.cucumber but work with cucumber.api #368

Open
kennethoys opened this issue Jul 8, 2019 · 18 comments
Assignees
Labels
Milestone

Comments

@kennethoys
Copy link

Eclipse 4.10.0 2018-12
Cucumber Eclipse Plugin 0.0.23.201811220126

image

With io.cucumber
image

image

With deprecated cucumber.api
image

image

@timtebeek
Copy link

@qvdk The annotations were moved to io.cucumber in 4.5.x ahead of a 5.x release; What would be needed for the plugin to pick up these changes? Should we upgrade the library versions in https://github.com/cucumber/cucumber-eclipse/tree/master/cucumber.eclipse.backends.java/lib ? Or do you recon any other changes would be needed?

@qvdk
Copy link
Member

qvdk commented Jul 11, 2019

Hi @timtebeek

The upgrade of cucumber libraries will not solve this issue.
Unfortunatelly, the plugin does not delegate the work to the cucumber library itself. Presently, the plugin have its own implementation to resolve glue and gherkin analysis.
This is an issue.
Idealy, the plugin should delegate all works to cucumber itself. The user should be able to choose its cucumber version as the JDK and JRE can be added in Eclipse. Then, the plugin should play with the selected version of cucumber.

For now, as a workaround, you need to play with cucumber.eclipse.steps.jdt.JavaStepDefinitionsProvider. Its job is to parse Java files to search gherkin step definition implementations.

You will see in the first lines:

private final Pattern cukeAnnotationMatcher = Pattern.compile("cucumber\\.api\\.java\\.([a-z_]+)\\.(.*)$");
private static final String CUCUMBER_API_JAVA = "cucumber.api.java.";
private static final String CUCUMBER_API_JAVA8 = "cucumber.api.java8.";
private static final String REGEX_JAVA8_CUKEAPI = "cucumber\\.api\\.java8\\.(.*)";

This constants are used in this class to search the imports of Given, When, and other Gherkin keywords. Thus to be compliant with those of the Cucumber 5.x, the plugin should be able to parse both, or to detect the cucumber version used to search only the right packages.

Hope that helps.

@timtebeek
Copy link

Pushed some code to a branch just now in #369 ; Could you have a look if this matches what you envisioned?

@RusmanCool
Copy link

@timtebeek I have the latest plugin version from ZIP archive(v 1.0.0.201907020018), and the issue is still present in Eclipse Version: 2019-06 (4.12).

@laeubi
Copy link
Contributor

laeubi commented Jul 26, 2019

@timtebeek is there a simple project I can download that uses the new annotation? I'll then take a look at this, shouldn't be a problem.
The problem with delegation to cucumber itself is, that the cucumber code is not very "IDE friendly" and clearly optimized for internal use only.
Even worse, with Gherking6 the decided to not even provide real java support but packing some large GO binaries to do the job so it would be nearly impossible to get any sensible information from cucumber/gherking itself in an IDE like fashion see
cucumber/common#425
cucumber/common#589

@timtebeek
Copy link

@laeubi Thanks for offering to help! @qvdk mentioned he usually ust plays around with the cucumber-jvm examples in https://github.com/cucumber/cucumber-jvm/tree/master/examples .

Note that the cucumber-jvm examples were changed to use cucumber expressions rather than regular expressions over a year ago, but it's unclear whether the plugin presently supports both: cucumber/cucumber-jvm@a4a3ad5#diff-bfebe34154a0dfd9fc7b447fc9ed74e9

@mpkorstanje
Copy link
Contributor

@laeubi

The problem with delegation to cucumber itself is, that the cucumber code is not very "IDE friendly" and clearly optimized for internal use only.

I am aware that it is a problem. But I'm unfamiliar with the needs of an IDE to really account for it. Would you be able to create a few tickets that outline the things that need to be facilitated?

Even worse, with Gherking6 the decided to not even provide real java support

I don't expect Cucumber JVM will use Gherkin 6 until it does.

@laeubi
Copy link
Contributor

laeubi commented Jul 26, 2019

@mpkorstanje thanks for offering support in that area, should I file issues against https://github.com/cucumber/cucumber-jvm/issues ?
One issue for example is that we can't access the parsed tree of cucumber expressions, but that might be an issue of cucumber-expresions? It's really a little bit confusing and hard to decide where to place these issues :-)

@mpkorstanje
Copy link
Contributor

mpkorstanje commented Jul 26, 2019

When in doubt I'd start with Cucumber-JVM. I also think we may need to use something that isn't tied quite so strictly to a specific Cucumber JVM implementation version (i.e. a JSON representation) so hopefully the Cucumber expressions shouldn't come into it so much.

@timtebeek
Copy link

Added a comment to cucumber/cucumber-jvm#1711 (comment) which might be relevant here; it's a new approach at running a plugin in cucumber-jvm itself to let it tell you which lines in .features match which lines in .java files. Hope it helps getting 5.0 support off the ground, and could remove the need for a parallel feature discovery layer in cucumber-eclipse.

@laeubi laeubi self-assigned this Aug 11, 2019
@laeubi laeubi added this to the 1.0.0 milestone Aug 11, 2019
qvdk added a commit that referenced this issue Sep 2, 2019
Fix 368 by also matching `io.cucumber` annotations and interfaces
@laeubi laeubi added the v1.x label Sep 14, 2021
@laeubi
Copy link
Contributor

laeubi commented Sep 14, 2021

We are currently developing a new version of the cucumber-plugin with improved support for more recent cucumber versions, if you like try out the following update-site (please uninstall the old plugin before):
https://cucumber.github.io/cucumber-eclipse/update-site/main/

@ryanh007
Copy link

Does this require a minimum version of eclipse? Getting the errors below using 2020-06 (4.16) even after uninstalling the old cucumber version
thx!

Cannot complete the install because of a conflicting dependency.
  Software being installed: Cucumber Eclipse 2.0.0.202109141006 (cucumber.eclipse.feature.feature.group 2.0.0.202109141006)
  Software currently installed: Eclipse Java Development Tools 3.18.400.v20200604-0540 (org.eclipse.jdt.feature.group 3.18.400.v20200604-0540)
  Only one of the following can be installed at once: 
    Java Code Manipulation Functionality 1.14.0.v20200526-0740 (org.eclipse.jdt.core.manipulation 1.14.0.v20200526-0740)
    Java Code Manipulation Functionality 1.14.400.v20210531-0737 (org.eclipse.jdt.core.manipulation 1.14.400.v20210531-0737)
  Cannot satisfy dependency:
    From: Cucumber Eclipse 2.0.0.202109141006 (cucumber.eclipse.feature.feature.group 2.0.0.202109141006)
    To: org.eclipse.equinox.p2.iu; io.cucumber.eclipse.java [2.0.0.202109141006,2.0.0.202109141006]
  Cannot satisfy dependency:
    From: Java 2.0.0.202109141006 (io.cucumber.eclipse.java 2.0.0.202109141006)
    To: osgi.bundle; org.eclipse.jdt.core.manipulation 1.14.200
  Cannot satisfy dependency:
    From: Eclipse Java Development Tools 3.18.400.v20200604-0540 (org.eclipse.jdt.feature.group 3.18.400.v20200604-0540)
    To: org.eclipse.equinox.p2.iu; org.eclipse.jdt.core.manipulation [1.14.0.v20200526-0740,1.14.0.v20200526-0740]

@laeubi
Copy link
Contributor

laeubi commented Sep 15, 2021

You should at least use 2021-03 as this release contains an important fix / API improvement.

@timtebeek
Copy link

I think this issue has since been solved in newer releases. I'd suggest closing this one if you all agree .

@ryanh007
Copy link

ryanh007 commented Mar 10, 2022

Not sure if my setup is wrong, but still cant get steps to match glue code. Also when I right click on the feature file I see no Cucumber options (Pretty format, Find Step, Scan etc) and the keyboard shortcut to create the step is not recognized.
Java 11, Eclipse 2021-12, Cucumber plugin 2.0.0.202110241342, Cucumber v6.11.0

Edit: Nevermind, added my feature folder as a source and seems to work, but still not seeing the right click options?

Thanks for plugin, this is super helpful!

@nramu33
Copy link

nramu33 commented Apr 25, 2022

@ryanh007 could you please share me the link to get Cucumber plugin 2.0.0.202110241342.

@ryanh007
Copy link

ryanh007 commented Nov 8, 2022

@nramu33 It used to be on https://cucumber.github.io/cucumber-eclipse/update-site/main/ but looks like that got pulled down. Not seeing any other way to get 2.X. Is the support for this plugin End of Life at this point?

@mpkorstanje
Copy link
Contributor

The update site is still there. You have to add it to Eclipse, not visit it with your web browser.

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

No branches or pull requests

8 participants