{"id":510,"date":"2015-06-17T09:39:08","date_gmt":"2015-06-17T09:39:08","guid":{"rendered":"http:\/\/www.gallop.net\/blog\/?p=510"},"modified":"2022-07-28T14:39:42","modified_gmt":"2022-07-28T09:09:42","slug":"pragmatic-test-automation-with-geb-2","status":"publish","type":"post","link":"https:\/\/www.cigniti.com\/blog\/pragmatic-test-automation-with-geb-2\/","title":{"rendered":"Pragmatic Test Automation with GEB"},"content":{"rendered":"
Geb is a Web automation framework using Groovy. It is basically a wrapper over Selenium and provides lots of functionalities making the job of test automation easy and quicker. In this post we talk about Geb & Spock (Groovy) automation framework based on our deep experience in implementing test automation solutions across technologies. Needless to say, GEB helps jumpstart test automation with all the cutting edge automation features ready.<\/p>\n
By using GEB & SPOCK framework since the beginning, one can definitely gain advantage over typical Selenium Webdriver Frameworks implemented in Java. There are a few major issues with Selenium WebDriver which results in test architects using Groovy automation framework over it. Below are few suggestions to be kept in mind before using Java for Test Automation:<\/p>\n
It\u2019s a catch 22. We want to leave Java being an overkill for test automation, but at the same time we want to keep using it because it is full of features and comes with an unmatched open source support. So is there a way, we can use Java without actually using Java?<\/p>\n
Answer is Yes, <\/strong>Groovy.<\/strong> Groovy offers:<\/p>\n Geb is a Web automation framework using Groovy. Geb uses WebDriver to test web applications using either real browsers or the HtmlUnit library. What sets Geb apart from the competition is the jQuery-like syntax for querying your HTML pages and its built-in support for the Page Object pattern.<\/p>\n GEB does all the heavy lifting under the hood, eases and improves the productivity of an automation developer manifold.<\/p>\n Few Highlights of Geb:<\/strong><\/p>\n A typical GEB automation script:<\/strong> The combination of Groovy and GEB is really simple and elegant but the real power comes when it is combined with SPOCK which is a Groovy Unit testing framework (inspired from Junit) which adds lots of much required features in the test automation. Spock is an out of the box framework which works well without compromising the overall simplicity and design of Groovy and GEB framework. <\/strong>There are a couple of strong features which come from SPOCK but it is not a comprehensive list mentioned below:<\/p>\n Under the hood, GEB uses powerful Selenium WebDriver APIs which does not need any introduction in the test automation world. In fact, it has become the de facto standard across industry. GEB uses all the power inherited in the Selenium WebDriver API without exposing the complexity to the end User.<\/p>\n The framework has been designed to specially encounter the most pressing problem in test automation-Cross browser Support. It supports execution on all the standard prevailing browsers, including IE, Firefox, Chrome and more. It also supports headless browser execution for quick turnaround for building verifications and smoke test suites.<\/p>\n It has been designed to support CI execution, which has been tested and proven with large scale test automation with Jenkins, which is the standard CI tool for the industry.In the same way it can be integrated with other CI tools as it supports extensively multiple build tools including Maven & Gradle which helps to provide plug and play solutions for most CI test environments.<\/p>\n \u00a0<\/strong><\/p>\n It has been completely integrated with BrowserStack, which can be utilized over the air for a quick build verifications or large automation suite in any desired environment having support for Cross Platform and across browsers including Windows, MAC, and Linux with IE, Firefox and Chrome browsers.<\/p>\n Apache Maven is an effective software project management and comprehension tool. Based on the concept of an overall project object model (POM), it can be used to \u00a0manage a project’s build, reporting and documentation from a central piece of information.<\/p>\n Gradle is a project automation tool that builds upon the concepts of Apache Ant and Apache Maven and introduces a Groovy-based domain-specific language (DSL) instead of the more traditional XML form of declaring the project configuration. Gradle takes the build automation capability to the next level from the Ant & Maven with the grace and easiness of Groovy. This framework works with Gradle completely and can be integrated with a variety of tools further, using Gradle seamlessly and quickly.<\/p>\n Synergy which comes with the integration of all these tools & components, significantly helps to jump start the test automation in most of the settings right away, which in turn accelerates the overall testing process, as observed in a number of our diverse project\u2019s environments in Cigniti.<\/p>\n\n
GEB Automation Framework:<\/h4>\n
<\/h4>\n
\n
\n
The simple,elegant & intuitive scripting as above, makes test automation really easy, fast and effective. This further makes test automation maintenance simpler to update as required with minimal technical complexity, which is really an aid as the test automation grows in terms of size and complexity over the period of time.<\/p>\nSPOCK: Groovy Unit Testing Framework<\/h4>\n
\n
Selenium Webdriver<\/h4>\n
Cross Browser Support<\/h4>\n
<\/h4>\n
Seamless Integration with CI(Jenkins)<\/h4>\n
Cloud Based Test Execution with BrowserStack & Sauce Labs<\/h4>\n
<\/h4>\n
Maven<\/h4>\n
Gradle<\/h4>\n