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

Karate engine re-write - exit from Cucumber but retain 100% syntax backwards compatibility #444

Closed
vijayqaguy opened this Issue Jul 3, 2018 · 15 comments

Comments

Projects
None yet
4 participants
@vijayqaguy
Copy link

vijayqaguy commented Jul 3, 2018

Any plans upgrade Cucumber version to 2 or 3?

We use Cucumber version 2 for our UI automation. Now if I import karate using maven, it conflicts with the version used for UI since karate using Cucumber version 1

@vijayqaguy vijayqaguy changed the title Any plans to upgrade Cucumber version 2 Any plans upgrade Cucumber version to 2 or 3 Jul 3, 2018

@ptrthomas

This comment has been minimized.

Copy link
Contributor

ptrthomas commented Jul 4, 2018

not right now unless we see more demand for this. advise stick to cucumber v1.2.5 as far as possible.

marking this ticket as "help wanted".

@ptrthomas ptrthomas removed the help wanted label Jul 9, 2018

@ptrthomas ptrthomas self-assigned this Jul 9, 2018

@ptrthomas ptrthomas changed the title Any plans upgrade Cucumber version to 2 or 3 Allow Karate to be mixed in Cucumber 2.X or 3.X projects Jul 9, 2018

@ptrthomas

This comment has been minimized.

Copy link
Contributor

ptrthomas commented Jul 9, 2018

plan to start work on this soon.

  • use a custom parser and life-cycle for execution + reports
  • support the existing Gherkin and keywords with 100% backwards compatibility
  • possibly need a thin wrapper for IDE support to work - have to "trick" IDE-s into thinking that Karate is exposing standard step definitions

considering writing a grammar in ANTLR

@ptrthomas ptrthomas changed the title Allow Karate to be mixed in Cucumber 2.X or 3.X projects Karate engine re-write - exit from Cucumber but retain 100% syntax backwards compatibility Jul 16, 2018

@ptrthomas

This comment has been minimized.

Copy link
Contributor

ptrthomas commented Jul 16, 2018

this work will involve taking a re-look at reports. would like to de-couple these from cucumber as well - but retain the cucumber JSON format

additional capability proposed:

  • way for users to inject custom snippets and even images into the report.
@ptrthomas

This comment has been minimized.

Copy link
Contributor

ptrthomas commented Jul 22, 2018

been doing analysis, this is going to be a lot of work ! but convinced this is top priority. not because we want to support that small percentage of users who insist on using Cucumber + Selenium. but because we want to be ready for Java 9/10 and we really don't need all the complexity and breaking changes that Cucumber v2 and v3 have introduced. I also personally do not agree with the decision the Cucumber team has made to use an out-of-JVM process (Go native binary) for Gherkin parsing in v3 v4 (?) onwards. https COLON SLASH SLASH github.com/cucumber/cucumber/pull/424

for Karate - we are clear. we love the JVM. it is what allows us to do mocks (netty) and performance testing (gatling)

meanwhile, I can see that IntelliJ has yet to catch up with the v3 Cucumber changes: https://youtrack.jetbrains.com/issue/IDEA-193111

Not 100% sure about Eclipse, but we certainly don't care about the Lambda support: https COLON SLASH SLASH github.com/cucumber/cucumber-eclipse/issues/267

the worst case scenario is that Cucumber Java IDE support will show warnings because it can't find the "glue" etc. pefectly reasonable IMO.

would be interested in hearing what others think.

@ayoolaogunsola

This comment has been minimized.

Copy link

ayoolaogunsola commented Jul 25, 2018

Would this affect the use of BDD-style tests (i.e feature files with scenarios/scenario outlines)? Also, would we lose the cucumber formatting and test run support within IDEs? The fact that Karate is based on cucumber was one of the attractions to this framework.

@ptrthomas

This comment has been minimized.

Copy link
Contributor

ptrthomas commented Jul 25, 2018

@ayoolaogunsola thanks !

  • as the title of this issue says we will have 100% backwards compatibility, yes Scenario / Outline, Given When etc.
  • so yes, formatting support will be retained
  • IDE integration by which I assume you mean "right-click-and-run" - this is where it gets hacky. I'm pretty confident though but cannot guarantee this 100%
  • "based on Cucumber" - you may want to read this thread very carefully: #398
@ayoolaogunsola

This comment has been minimized.

Copy link

ayoolaogunsola commented Jul 25, 2018

@ptrthomas Thanks for clarifying. I don't have a need to integrate with Cucumber so as long as Karate keeps its simplicity, no concerns here. It's working well for our needs so far. Thanks for a great tool.

@ptrthomas ptrthomas added this to the 0.9.0 milestone Jul 29, 2018

@ptrthomas

This comment has been minimized.

Copy link
Contributor

ptrthomas commented Jul 29, 2018

missed tagging this ticket but this commit has the initial implementation of the antlr grammar and even the execution life-cycle is working :) the next big task is reporting.

99a2843

ptrthomas added a commit that referenced this issue Aug 2, 2018

cukexit wip coming along well #444
engine class static methods has responsibility to execute feature
json output should be near ready now, also result skipped logic in place

ptrthomas added a commit that referenced this issue Aug 19, 2018

cukexit wip a big milestone ref #444
where the implementation of the call keyword has been switched to the new engine

ptrthomas added a commit that referenced this issue Aug 19, 2018

cukexit wip the parallel runner works ! ref #444
the demos are working including reports TODO called steps
support for the legacy cucumber-options, only tags and features
new scenario-hooks strategy
todo time reporting and hiding skipped features
but it does look like the bulk of the work is over
@thirdy

This comment has been minimized.

Copy link

thirdy commented Aug 20, 2018

Hi. Is there now a way to extend the DSL? I understand there was a discussion of it in #398. In my case, I want to make it simpler to build requests and provide reusable queries to responses. Something like:

* firstName Karl
* lastName Marx
* GetUser
* response.someComplexQuery == '2013-01-01'

GetUser will implicitly use the the given parameters to build the Request and also run the Http call. Then response will have some common fields to be tested. GetUser will also check config.channel if it's REST or SOAP, and will adopt accordingly.

So what I have now is a DSL specialized to our API.

Would appreciate any advice on how I should approach this. Maybe even write my own ANTLR grammar?

@ptrthomas

This comment has been minimized.

Copy link
Contributor

ptrthomas commented Aug 20, 2018

@thirdy I think I have been very clear in this comment:
#398 (comment) - and strongly feel you can use Karate the way it is.

there's also some very early thoughts here, but this is not a priority until we move everything out of Cucumber:
#489 (comment)

ptrthomas added a commit that referenced this issue Aug 26, 2018

@ptrthomas

This comment has been minimized.

Copy link
Contributor

ptrthomas commented Aug 27, 2018

again forgot to tag this issue but this commit is a big milestone: d6e5f4b

we have successfully removed all dependencies on cucumber except for the critical few needed for backwards compatibility

the 2 reports (JSON, HTML) need to be worked on to bring them to the original state - but most of the pain is over

@ptrthomas

This comment has been minimized.

Copy link
Contributor

ptrthomas commented Sep 10, 2018

I'm going to go ahead and mark this as fixed. this is a big deal and took far more work than I anticipated.

we don't depend on the fate of the Cucumber-JVM project anymore.
we control the entire life-cycle and reporting, which feels very liberating
even IDE support continues to work for cucumber-jvm 1.2.5 (karate default)

Please do try this out from the cukexit branch. We really need this help and feedback to ensure your existing karate-suites continue to work.

an interesting design decision is to continue to bundle the info.cukes:cucumber-java:1.2.5 dependency. this is purely for Eclipse and IntelliJ syntax coloring to work !

regarding the original issue by @vijayqaguy - you should be able to mix karate with newer cucumber versions. but IDE support may then break, which may require some community contribution to resolve. the new design of the step-definitions will make this easier (thin layer, using interfaces etc)

again, if you can clone and test this, please do help !

@ptrthomas

This comment has been minimized.

Copy link
Contributor

ptrthomas commented Sep 15, 2018

found this twitter rant about Cucumber API breaking changes, saving this here for future reference

https://twitter.com/GarthGilmour/status/1031924983403044864

@ptrthomas

This comment has been minimized.

Copy link
Contributor

ptrthomas commented Nov 9, 2018

saving this link for future reference, some discoveries the cucumber team made with the "go binary" approach: cucumber/cucumber#425 (comment)

looks like we did the absolute right thing.

@ptrthomas

This comment has been minimized.

Copy link
Contributor

ptrthomas commented Dec 2, 2018

HELL YEAH ! 0.9.0 released

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.