Skip to content

Iptv Assist

Learn More from us

Menu
  • HOW TO
  • Firestick
  • Chromecast
  • PC Apps
  • Lg Smart TV
  • IPTV Services
  • Automation Testing
  • Smart TV
  • Software Testing Tools
  • Contact Us
Menu

Geb Tutorial – Browser Automation Testing Using Geb Tool

Posted on March 26, 2023

Best Iptv Service Provider 2023 With 40k+ Channels And 100k+ VOD . 24/7 Suppport . Paypal Supported

Geb (pronounced “jeb”) is the answer to the challenges of browser automation. It is a very effective tool to perform automation testing over the web.

Best Iptv Service Provider 2023 With 40k+ Channels And 150k+ VOD . Hurry Up

Geb originated out of the need to make browser automation (initially for web testing) less complicated, hassle-free and more efficient. It may be utilized for programming, extracting data from the web and automating the manual web tasks. Additionally, Geb is a cross-browser tool for automation testing.

Recommended IPTV Service Providers

  1. IPTVGREAT – Rating 4.8/5 ( 600+ Reviews )
  2. IPTVRESALE – Rating 5/5 ( 200+ Reviews )
  3. IPTVGANG – Rating 4.7/5 ( 1200+ Reviews )
  4. IPTVUNLOCK – Rating 5/5 ( 65 Reviews )
  5. IPTVFOLLOW -Rating 5/5 ( 48 Reviews )
  6. IPTVTOPS – Rating 5/5 ( 43 Reviews )

 

Geb functions as a developer-driven tool for automating the collaboration between web browsers and web content. It runs the WebDriver in Groovy language.

The beauty of Geb testing tool is that it combines the best features of Groovy programming language, jQuery, WebDriver and Page Object Modelling to provide powerful, robust & dynamic content inspection, selection and web interaction.

Geb Browser automation solution

What makes Geb unique when compared to other automation testing tools available in the market is its syntax. It is similar to jQuery that is normally used for querying the HTML pages easily. Secondly, it has integrated support for the Page Object pattern.

Geb provides great help for functional web testing through integration with some broadly used and common testing platforms including Spock, Grails, JUnit, Cucumber-JVM, TestNG, etc. We will see how Geb can be integrated with Grails framework in the later part of this article.

What You Will Learn:

  • Practical Uses
  • Advantages
  • Prerequisites
  • Getting Started
  • Learn with Example
  • Database validation testing through Geb script:
  • Few useful Methods in Geb
  • Drawbacks of this tool
  • More resources:
  • Conclusion

Practical Uses

As already discussed in the introduction of this Geb tutorial, it can be used:

  • As a Testing tool on multiple browsers like chrome, Firefox, Internet explorer, etc. (The same automation script can be run on different browsers to perform web testing of your application.)
  • To automate User acceptance and functional test cases.
  • To automate test scenarios created for functional or web testing of any application.
  • To cover the end to end testing including the UI (User Interface) validation and DB (Database) validation.
  • As a Developer’s tool for automating the interaction between a web browser and web content.

Advantages

  • Geb is a free, open-sourced tool. It is licensed under the Apache License, Version 2.0.
  • Easy and simple to automate web testing.
  • Geb’s Page Objects and Groovy DSL make tests readable to the extent that they almost look like plain English.
  • Runs the tests fast and thus saves the time and cost of testing.
  • Compatible with different browsers like IE, Firefox, Chrome, and HTMLUnit.
  • It executes the tests in the real browser. It is as if testing in the real environment- the one that the user would see.
  • It makes the regression testing easy. You can run the Geb automated test cases to check if any existing functionality is breaking after a fix or change in the application.
  • While using Geb for automation testing, minimal test code changes are required if there are any UI changes in your application. So, it reduces the effort & duplication of code.
  • It helps 360 degrees (or maximum) testing coverage within the single script.

Prerequisites

Before getting started, we need to download and install the software. At the central Maven repository, Geb is available as a single Geb-core jar. Click here to install it on your machine.

You will need the above Geb-core jar, a web driver implementation, and the selenium-support jar to get Geb working on your machine.

Please refer to the below installation and usage section of the book of Geb to install the tool and get it running => Geb installation and usage manual.

Getting Started

As already discussed, Geb can be integrated with different testing frameworks.

Depending on the framework you have chosen, you will need to install the related plugin.

For example: Grails (Grails is a very famous framework for web applications) to write automation test scripts and automate the test scenarios. If you wish to use Geb for your Grails functional testing, you can install the related plugin from here grails-geb plugin.  This plugin handles the baseUrl and reportsDir configuration items.

Learn with Example

Let me now show how to write a Geb script to automate a test scenario.

Take the below test scenario:

Test Scenario ID Softwaretestinghelp-1 Test Case Id Softwaretestinghelp -1A
Test Case Description Verify Softwaretestinghelp.com Page through search engine Automation Script Status In Progress
Pre-requisite 1 Browser
2. search engine
3. website – Softwaretestinghelp.com should exist
Pre-requisite Script NA

The execution steps are:

Launch google search engine
Verify if the search engine has been loaded successfully
Enter softwaretestinghelp.com in the search box
Wait for results to load
Verify if the first link in results is directing to softwaretestinghelp.com
If yes, open the link.
Wait until the website opens up.
Exit

Here is the Geb automation tool script for the above scenario:

import geb.Browser
Browser.drive {
go "http://google.com/"

//verify if we are on the correct page
assert title=="Google"

//enter softwaretestinghelp.com into the search field
$("input",name:"q").value("softwaretestinghelp.com")

//wait for the change to results page to happen
//(google updates the page dynamically without a new request)
waitFor{ title.endsWith("Google Serach")}

//is the first link to softwaretestinghelp.com?
def firstLink = $("li.g,0).find("a.l")
assert firstLink.text()= ="Software Testing Help - A Must Visit Software Testing Portal"

//click the link
firstLink.click()

//wait for Google's javascript
waitFor { title = ="Software Testing Help - A Must Visit Software Testing Portal" }
}

You can now try writing a simple GEB script on your own referencing the above example.

Database validation testing through Geb script:

Any web automation testing is divided into three parts:

  • UI Validation – Validating the data reflected on the user interface (front end) before & after the automation test scenario run.
  • DB Validation – Validating the data reflected in the database (backend) before & after the automation test scenario run.
  • Actual Test flow/ Script flow.

The Geb script written to automate a test scenario can contain the code for all of the above three sections.

The Geb script in the above example section was for automating the test flow and UI validation. Similarly, you can write a test script for database validation.

For any DB validation test, you can always use the below template as an outline for your code:

def validateDB(/*define all variables here*/) {
def errorMessages = ""
try {
Configuration conf = (new ConfigurationLoader()).getConf()
def sql = Sql.newInstance(conf.readValue("dbPath", ""), conf.readValue("dbUserName", ""), conf.readValue("dbPassword", ""), conf.readValue("dbDriverName", ""))

/* Populate any required variables */
}

/* Give print commands here to print required values */
def qry = /* select statement to pull all required values from database */
println "SQL=$qry"
sql.eachRow(qry) { row ->

/*  ‘if’ block to perform validation and returning error in case of any variations */
}
catch(Exception e) {
println "EEEE=$e"
}
return errorMessages
}

Few useful Methods in Geb

  • When your test case scenario involves multiple tabs and windows: Whenever you come across an application that opens up new windows or tabs, For example when clicking on a link with a target attribute set, you can make use of withWindow() and withNewWindow() methods to execute code in the context of other windows.
  • The drive method: Browser class contains a static method – drive(). This method gives an extra convenience to Geb scripting. All top level method calls and property accesses are implied to be against the browser.
  • Making Requests: Browser instances uphold a baseUrl property that is employed to resolve all relative URLs. It is usually most preferable to define your base URLs with trailing slashes and not to use leading slashes on relative URLs.
  • Changing the Page: With the help of useful page() methods, it is feasible to change the page instance without making a new request.
  • Quitting the Browser: The browser object provides quit() and close() methods (that simply handover the task to the base driver).

Drawbacks of this tool

  • Geb executes WebDriver in the Groovy language. The whole idea behind this is to make the use of WebDriver easier and simpler. So, when you using Webdriver through Geb, only Groovy programming language will be supported. But, if you directly use WebDriver, it supports many languages like Ruby, C#, Python, Java.
  • I would not suggest the use of Geb for small projects – It works awesome for enormous tasks but takes a hit on small activities. If your web application does not contain multiple pages and forms through which the information needs to flow, you may discover Geb really costs you additional time than it spares.
  • It is very particular about what environment your website application utilizes. Geb is required to be well integrated into a specific environment to make it function fine.

More resources:

  • Check out the Book of Geb here for detailed documentation and examples.
  • Here is a sample project showing the integration of Geb with grails.

Conclusion

Geb is very useful in automating test case scenarios. It is useful to automate web, functional and user acceptance testing. It supports multiple browsers and can be integrated with different frameworks. It combines the power of WebDriver, elegance of jQuery Selection, the robustness of Page Object Modelling and expressiveness of Groovy.

Geb scripts are both developer and user-friendly providing better test coverage and accelerated testing while making it more efficient at the same time.

About the author: This is a guest post by Priya K. She is having 4+ years of experience in IT Services with expertise in Testing and support for various applications.

Feel free to post your Geb automation testing queries in comments.

Related

Best Iptv Service Provider 2023 With 40k+ Channels And 150k+ VOD . Hurry Up

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • IPTV List: Best iptv lista 2023
  • IPTV Premium: Best Premium IPTV Service Provider List And Benefits
  • Nikon IPTV Review: Over 10,000 Live Channels for $12/Month
  • Iptvwings. Com Review: +18000 Live IPTV Channels ,+70000 Movies, +40000 TV show For $15/1 month
  • IPTVUNO Review: More Than 16000 Live TV channels, 55,000 Movies & VOD For $15/Month

Recent Comments

  1. IPTV List: Play lista iptv 2022 - Iptv Assist on Best IPTV Player in 2023 for Watching Live TV
  2. Cola IPTV – Over 18,000 Live Channels for $12/Month - Iptv Assist on FileLinked – How to Install on Firestick/Fire TV and Android Devices
  3. Cola IPTV – Over 18,000 Live Channels for $12/Month - Iptv Assist on 50+ Best IPTV Service Providers for Streaming Live TV 2023
  4. XoomsTV IPTV – Over 11,000 Channels & VOD for Under $13/Month on Best VPN for IPTV in 2023 and How to Install on Firestick/Android
  5. Voodoo Streams IPTV Review – Over 12,000 Channels for $11/Month - Iptv Assist on Dynasty TV IPTV Review – Over 6,000 Channels for $10/Month

Archives

  • March 2023

Categories

  • Activate
  • Agile Testing
  • Alternatives
  • Android
  • APK
  • Apple TV
  • Automation Testing
  • Basics of Software Testing
  • Best Apps
  • Breakfast Hours
  • Bug Defect tracking
  • Career in Software Testing
  • Chromebook
  • Chromecast
  • Cross Platform
  • Database Testing
  • Delete Account
  • Discord
  • Error Code
  • Firestick
  • Gaming
  • General
  • Google TV
  • Hisense Smart TV
  • HOW TO
  • Interview Questions
  • iPhone
  • IPTV
  • IPTV Apps
  • Iptv Service SP
  • IPTV Services
  • JVC Smart TV
  • Kodi
  • Lg Smart TV
  • Manual Testing
  • MI TV
  • Mobile Testing
  • Mod APK
  • newestiptv.com
  • News
  • Nintendo Switch
  • Panasonic Smart TV
  • PC Apps
  • Performance Testing
  • Philips Smart TV
  • PS4
  • PS5
  • Python
  • QA Certifications
  • QA Leadership
  • QA Team Skills
  • Quality Assurance
  • Reddit
  • Reviews
  • Roku
  • Samsung Smart TV
  • Screenshot
  • Selenium Tutorials
  • Sharp Smart TV
  • Skyworth Smart TV
  • Smart TV
  • Soft Skills For Testers
  • Software Testing Templates
  • Software Testing Tools
  • Software Testing Training
  • Sony Smart TV
  • Sports
  • Streaming Apps
  • Streaming Devices
  • Tech News
  • Test Management Tools
  • Test Strategy
  • Testing Best Practices
  • Testing Concepts
  • Testing Methodologies
  • Testing News
  • Testing Skill Improvement
  • Testing Tips and Resources
  • Toshiba Smart TV
  • Tutorials
  • Twitch
  • Types of Testing
  • Uncategorized
  • Vizio Smart TV
  • VPN
  • Web Testing
  • What is
  • Xbox
©2023 Iptv Assist | Design: Newspaperly WordPress Theme