From the course: Cucumber Essential Training

Web browser automation

From the course: Cucumber Essential Training

Start my 1-month free trial

Web browser automation

- [Instructor] Cucumber Essentials, Web Browser Automation. How about we introduce some web browser-based testing to our existing scenarios? We are going to do this with the help of a tool called Selenium. When we are done implementing this web browser automation, this is how our workflow will look like. Our step definitions will invoke some Selenium-based code, which, in turn, will use a browser-specific driver to invoke a webpage and interact with it. I'd like to mention a couple of things before we proceed. Selenium refers to a suite of products. We will only use Selenium WebDriver dependencies for Java and Chrome browser. There are dependencies for other browsers if you do not wish to use Chrome. Let's continue our conversation to discuss the web automation architecture. The box on the left refers to language-specific client libraries that are developed for programming languages like Java, Ruby, or Python. We will use the Java application programming interface for our course. These libraries will interact with browser-specific drivers by using JSON or JavaScript Object Notation-encoded messages to transfer data over HTTP. Each driver has its own web server for this interaction. Each driver will invoke HTTP requests to their respective browser and get HTTP response back. As you can see in this slide, there are drivers specific to a browser type, and there are drivers for browsers that are not in this slide. You have the flexibility to use the programming language or browser of your choice. One key thing to note here is that Cucumber has no knowledge of Selenium or any web browser. Its job is to match scenario steps to step definition methods. What we write in the step definitions is up to us. It is Selenium that implements web browser automation. Selenium hooks Cucumber step definitions to web browser automation. I built a simple GSP website running on Apache Tomcat web server for our bill calculation scenario. As you can see, this is not the prettiest webpage. When you supply bill amount and tax, such as $500 and 10%, it calculates the final bill amount with the tax amount included. I will include the source code of this web project in the course handouts.

Contents