Draft:Geb (testing framework)

Geb
Original authorsLuke Daley, Marcin Erdmann
DevelopersLuke Daley, Marcin Erdmann
Stable release
8.0.1 / November 11, 2025; 9 months ago (2025-11-11)
TypeTest framework
LicenseApache 2.0
Websitegroovy.apache.org/geb/
Repositorygithub.com/apache/groovy-geb

Geb (pronounced "jeb") is a functional test framework for browser web applications. It is backed by the Selenium WebDriver. The tests are written in the Groovy programming language. The test code syntax uses Groovy DSL that allows describing Page Object models (entire pages and their modules) in a declarative style.[1]

The framework can be integrated with test engines such as Spock, JUnit, and TestNG.[2]

Selecting web content

The content of a web page is usually selected via the $ method, which returns an object of the Navigator class. Such an object can wrap one or more objects of the WebDriver WebElement interface and provides additional functionality. The method extends the functionality of the Selenium finders by adding advanced features. It uses the jQuery style, e.g., the call $("div", 3, title: "section") returns the fourth (indexing begins with 0) DIV element with a title attribute value of "section". The full method signature is $(selector, indexOrRange, listOfAttributeAndOrTextAndOrVisibilityMatchers).

A Navigator object can be created dynamic. For such navigators, the related DOM elements are refreshed whenever they are accessed.

Page object pattern support

Geb Page Object models can describe both entire pages and modules that can be shared among different pages, such as navigation bars and footers. The model classes extend the library Page and Model classes.

The special Groovy DSL supports the declarative style and uses nested code blocks in braces, reflecting the elements hierarchy.

Integration with other tools

As a WebDriver wrapper, Geb allows direct access to its functionality when needed. Also, since it implements the WebDriver protocol, it can be integrated with Appium to support mobile testing.

Spock, JUnit, and TestNG test engines can be used to run Geb-based tests. For better integration with Spock, Geb provides the special GebSpec class.

See also

References

  1. ^ Muschko, Benjamin (19 February 2014). Gradle in Action. Manning. ISBN 978-1-61729-130-2.
  2. ^ Fletcher, Rob (May 2017). Spock: Up and Running. O'Reilly Media, Inc. ISBN 978-1-4919-2328-3.

Category:Cross-platform software Category:Java development tools Category:Java (software platform) Category:Graphical user interface testing Category:Software using the Apache license

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.