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

remove cucumber compatibility and stop depending on legacy cucumber code #2214

Closed
ptrthomas opened this issue Dec 12, 2022 · 14 comments
Closed
Assignees
Milestone

Comments

@ptrthomas
Copy link
Member

refer this issue: #2189

this will require us to use a custom parser that gets us out of the cucumber "step regex" that has been the engine for the last 6 years. now that we have official plugins and extensions for IDEs, it is time to make this shift

benefits:

  • we have been bundling a very old cucumber dependency info.cukes:cucumber-java:1.2.5 just for keeping cucumber plugins in IntelliJ and Eclipse happy. context is here: Karate engine re-write - exit from Cucumber but retain 100% syntax backwards compatibility #444 (comment) - and now we can jettison this
  • today we use reflection to "interpret" each step when running a feature, this is how Cucumber works, but we can switch to a more traditional object-model and possibly get a performance improvement
    • also opens up some code analysis, formatting, and conversion, for e.g. a builder to generate karate files or convert to other formats
  • we can better provide some IDE features such as IntelliSense and auto-complete in the official extensions without being hampered by Cucumber
  • we may even be able to drop the requirement of starting each line with * Given When And etc
  • open the way for doing some linting and static-code analysis tools for Karate
  • we can bend the rules of the Gherkin syntax where it makes sense. for example,
    • to call other features
    • mark sections for documentation, examples, dynamic data sources
@ptrthomas ptrthomas self-assigned this Dec 12, 2022
@ptrthomas ptrthomas added this to the 1.4.0 milestone Dec 12, 2022
@ptrthomas ptrthomas modified the milestones: 1.4.0, 1.5.0 Jan 31, 2023
ptrthomas added a commit that referenced this issue Jan 31, 2023
@ptrthomas
Copy link
Member Author

developer note: refer #1913 - this code has to be cleaned up, we are also planning to remove the continueOnStepFailure option - as no one seems to be using it, and it un-necessarily complicates the code (in my opinion)

please shout if any concerns cc @joelpramos

ptrthomas added a commit that referenced this issue Feb 2, 2023
also refer #2083 we have removed karate-mock-servlet
junit4 was removed in a previous commit
@ptrthomas
Copy link
Member Author

@kirksl please note this commit as part of refactoring and cleanup for 1.4.0 a6e6f51

we will no longer emit the karate-debug-port.txt file to be consistent with vs code best practices and for performance, port detection should be via the process output, and the official plugins do this already, we also had some issues with creating files. FYI in case you are still maintaining the karate-runner, thx !

@ptrthomas ptrthomas changed the title remove cucumber compatibility and use proper parser for syntax remove cucumber compatibility and stop depending on legacy cucumber code Feb 2, 2023
@ptrthomas ptrthomas modified the milestones: 1.5.0, 1.4.0 Feb 2, 2023
@ptrthomas ptrthomas added the fixed label Feb 2, 2023
@joelpramos
Copy link
Contributor

Still have several teams using it and I recall questions on stackoverflow. The linked PR explains why and we use it widely - why do you think no one uses and what’s the need to remove?

@ptrthomas
Copy link
Member Author

@joelpramos as far as I know there were 2 questions from people who perhaps tried it with no follow-up. in my opinion it is one of those things that people feel makes sense - but never actively use on a daily basis. I honestly think this is not a deal-breaker for karate, but of course just my opinion

anyway the main reason for removal is because it gets in the way of moving out of the cucumber regex approach. I believe after we complete that, we will use a DSL grammar which gives us a blank-slate to re-design the continueOnStepFailure approach. just for the record I was never in favor of adding this and it makes it harder for me to maintain the scenario-engine / runtime code.

@kirksl
Copy link
Contributor

kirksl commented Feb 3, 2023

@kirksl please note this commit as part of refactoring and cleanup for 1.4.0 a6e6f51

we will no longer emit the karate-debug-port.txt file to be consistent with vs code best practices and for performance, port detection should be via the process output, and the official plugins do this already, we also had some issues with creating files. FYI in case you are still maintaining the karate-runner, thx !

Thanks for the heads up @ptrthomas
kirksl/karate-runner#166

@joelpramos
Copy link
Contributor

joelpramos commented Feb 3, 2023

Shouldn’t get in the way of the rewrite (I haven’t been following recently but I’m sure there’s very good reason). Why don’t you proceed with rewrite, remove this keyword, and we’ll discuss a redesign after?

note the original intent which was just to be able to get information of all the matches that failed and not fail on the 1st one to avoid cases of fail/fix/fail etc. maybe we can consider a “multi match block” with syntax where we can put multiple statements (like the new line alternative right now) and that shouldn’t require to preserve state across each execution which is the odd part of the design right now, not really aligned with the rest of karate - just a thought of another way to go at it

@joelpramos
Copy link
Contributor

Now that I think about it the only reason why it was expanded to more keywords support was more cause we could and had to do some funky work to identify the type of keyword anyways - and still had to somehow many this not a hack that people could use it as if conditions to be truth to the original karate design

@joelpramos
Copy link
Contributor

Sorry for back to back spam but kind of like the “multi match block” approach, maybe even if it just receives a JSON array of matches with a nice way of reporting it back - I’m sure a custom parser that you’re chasing will keep our options open / open more options

@ptrthomas
Copy link
Member Author

@joelpramos I like the idea of a multi-match. let me try retain this keyword, but most likely I'll have to remove it when I do the cleanup and then we can add back continueOnStepFailure for 1.5 - we will certainly release a couple more RC releases for 1.4 to get wider feedback

@ptrthomas
Copy link
Member Author

ptrthomas commented Apr 2, 2023

1.4.0 released -

  • as of now continueOnStepFailure has not been removed
  • cucumber-java 1.2.5 was removed from the pom.xml - this may impact IDE plugins that look for this JAR as a "marker" or support syntax coloring / running a test from the editor
  • no other parser changes have been made, this is postponed for later - perhaps Karate 1.5

@mguzelel
Copy link

which means the cucumber for Java plugin is not supported anymore. are we going to use the Karate plugin?

@ptrthomas
Copy link
Member Author

@mguzelel the karate plugins for vs code and intelliJ are recommended

@ericdriggs
Copy link

ericdriggs commented May 1, 2023

Intellij Cucumber java plugin will still work if you specify the Main class as: com.intuit.karate.cli.IdeMain

@ptrthomas
Copy link
Member Author

Eclipse users have a workaround described here: https://stackoverflow.com/a/76294302/143475

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

No branches or pull requests

5 participants