getgauge / gauge-java

Java runner for Gauge

Home Page:https://gauge.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to integrate with Geb BindingUpdater

hungluong5791 opened this issue · comments

Hi,

I am currently trying to use Gauge for specs and Geb for implementation (since I don't want the alternative which is raw WebDriver).

Right now I want to make use of Geb + Groovy syntax, which Geb provides with the BindingUpdater mechanics (see https://gebish.org/manual/current/#cucumber-jvm). However gauge doesn't seem to pickup on the binding and instead go straight into the method.

Of course I could just go with Geb methods such as browser.go "abc.com" but repeating browser over and over defeats the expressiveness of Geb.

Has anyone tried this use case?

Hi, the closest we've got to supporting Groovy is this example: https://github.com/getgauge-examples/groovy-selenium (which uses WebDriver directly, unfortunately).

gauge-java is the only JVM plugin for gauge, and it uses reflection for scanning and identifying implementations, hooks etc.

In order to support Geb, there needs to be a plugin that not only understand's Groovy syntax, but also complies with the meta-programming that Geb uses so much.

Long story short - I think there is no straightforward way to use Geb idiomatically with Gauge, without writing plugin (a new or an enhancement to gauge-java).

Sidenote (plug disclaimer) - have you explored Taiko? If you are not particular about using Geb, then perhaps you can find similar expressiveness over there, and it works well with Gauge!

Hi,

Thank you for the explanation. I did take a look at Taiko and loved it very much. However my use case right now requires cross-browser testing including Safari so I don't think we can adopt Taiko anytime soon.

Speaking of, do you know of any plan for Taiko to "fallback" to the WebDriver protocol? I feel multi browser support is the only roadblock left now for widespread adoption.

do you know of any plan for Taiko to "fallback" to the WebDriver protocol?

No plans, and am not certain it is quite feasible. Taiko's behaviour relies on certain events/API that I don't think would be possible with webdriver.

I feel multi browser support is the only roadblock left now for widespread adoption.

Cross browser testing is something that keeps coming up. I know that Firefox is working on supporting CDP which could mean that Taiko could work with Firefox in the future. Safari could still be something where Taiko does not work.

Thank you for the explanation!

One more thing: from what I can gather, cucumber-jvm seems to handle Groovy/Geb binding by first adding all the reflected methods into a big class; while I understand gauge-java invoke the reflected methods separately - Geb does works if I put everything in a single script file.

Is this something gauge-java can change into or there should be a gauge-groovy for it?

I am not sure, I admit I'm not familiar with Geb.

However, if you are able to get geb/groovy working with gauge with some workaround/hack - feel free to propose what can be done in gauge-java to enable this support.

A separate plugin for groovy might mean more maintenance overhead, and I know there have been requests for other JVM languages (see #187 (Scala), getgauge/gauge#479 (Clojure), getgauge/gauge#793(Kotlin) or generally speaking getgauge/gauge#1275 (All JVM language)) - makes me think gauge-java could pivot into gauge-jvm. The tricky bit is to add authoring support which requires static analysis of code, which we only do for java at the moment.

Alright, I got all the answer I need. I understand that authoring support is a major point to consider and Groovy is notorious for being hard on IDEs.

I will dig around some more for Geb support feasibility but for the moment guess I will have to find an alternatives.

Thank you very much!