GEB wrapper Advantages over Selenium WebDriver/Java

1,072 views
Skip to first unread message

carlc986

unread,
Nov 18, 2015, 8:33:14 AM11/18/15
to Geb User Mailing List
I am currently evaluating the use of the GEB groovy interface for web-based automation verses just using the Selenium 2.0 WebDriver/Java API language. I was wondering what the true advantages this wrapper has over it, other than simplifying the Java coding aspect? Some of my other questions are:

1. Does the GEB wrapper allow you to run against any other WebDriver version like JavaScript, Python, etc...?
2. Does it speed up the test execution runs at all?
3. Does it allow parallel and distributed testing across browsers as TestNG and Java would using the Threading classes?
4. Does it allow bi-directional support of Xpath queries using ancestry?
5. Does it work on Mobile Web applications using a simulator and/or real device?
6. Would it allow a Selenium Driver class to be built that supports a ThirdParty test platform like SauceLabs?
7. Are TestNG Suite files allowed for passing in parameters and delegating the parallel test level and thread counts, etc...?
8. Why would one use this wrapper instead of just coding the framework using Java/TestNG and the Selenium WebDriver APIs?

Brian Kotek

unread,
Nov 18, 2015, 10:52:05 AM11/18/15
to Geb User Mailing List
I'll take a stab at this, and I'm sure Marcin can correct any errors I make:
  1. I'm honestly not sure what you even mean here. How would Java code run a JavaScript or Python Driver?
  2. No, it would be similar or even a bit slower, since Groovy itself imposes a small amount of overhead. The difference is usually small, but Geb's advantages don't revolve around "faster" test execution. They revolve around faster test creation and maintenance.
  3. I believe a Gradle build can trigger parallel test runs using different Drivers, but Marcin may be able to confirm/clarify.
  4. Geb tends to focus on CSS selectors, since that's generally the preferred way to locate things in the DOM. But if WebDriver supports it, you can always use the underlying WebDriver API if you need to.
  5. Again, if there's a Driver for what you want, then it should work with Geb as well. But if WebDriver doesn't support something, Geb generally can't either, since it relies on WebDriver. Geb is great, but it's not magic.
  6. Geb supports SauceLabs, if that's what you're asking. (http://www.gebish.org/manual/current/#cloud-browser-testing)
  7. I use Spock, so I don't know anything about Geb's TestNG support, other than knowing that you can use TestNG
  8. Many reasons:
    1. Geb code is much easier to write (and read) than raw WebDriver code
    2. The WebDriver API is a complicated mess (IMO at least). Geb simplifies things drastically
    3. Geb's jQuery-like API is easier to work with and more intuitive to web developers
    4. The Page Object and content DSL approach used by Geb is easier to create and maintain. Something similar could probably be hacked together for use in standard WebDriver, but it would be a real pain.
    5. Groovy is far (FAR) more flexible than standard Java. It allows much more dynamic behavior, the use of custom DSLs, and is just far more sane overall.
Basically, Geb is a great wrapper API around WebDriver that simplifies things and makes most tasks much easier. For many folks, having more good tests that are easier to write and maintain means more than shaving every second off of the test execution time. But your focus is on test execution speed, and that takes priority over ease of test creation and maintenance, it may not be your cup of tea. 


--
You received this message because you are subscribed to the Google Groups "Geb User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geb-user+u...@googlegroups.com.
To post to this group, send email to geb-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/geb-user/72f35c2f-4738-4185-8c75-b3d7ce2a7ab0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Marcin Erdmann

unread,
Dec 3, 2015, 6:34:15 PM12/3/15
to geb-...@googlegroups.com
Sorry for the radio silence, I was on holidays.

Just to add to what Brian has already said:
2. Yes, it will be slightly slower for two reasons:
- Groovy adds a runtime layer on top of Java which means that it will be slower (but not significantly) then running code written in pure Java
- Geb will sometimes make more WebDriver wire protocol request compared to when you would perform all WebDriver commands by hand and optimized for performance but you get more expressive, simpler and faster to write tests in return; I personally believe that the price is worth it
3. Yes, it is possible. Geb test suite is run in parallel in SauceLabs and BrowserStack using Gradle's Test task forking capability (i.e. the maxParallelForks property of Test task type)
4. No idea what bi-directional xpath queries using ancestry are but since 0.12.0 Geb supports using xpath selectors which delegate down to WebDriver so basically Geb can do anything WebDriver can do with regards to xpath selectors.


Reply all
Reply to author
Forward
0 new messages