E2E Testing with Cucumber and Browserstack

Sefa Bilgi
cloudnesil
Published in
4 min readJun 30, 2021

Write E2E BDD tests using Cucumber and Appium. I also use TypeScript for E2E test case, but both tools support multiple programming languages like Python, Java, Ruby and much more. I used Browserstack to view the result of the E2E test case.

What is BDD (Behavior Driven Development) and Why BDD ?

BDD is an agile software development process actively used to facilitate and encourage communication, collaboration and common understanding between developers, QA testers, customer representatives and stakeholders. One advantage of utilising BDD in software projects is to motivate all team divisions in software development to exchange communication through concrete examples and create a mutual understanding of the use and behaviour of an application or product.

In BDD you create your system requirements in a structural manner by utilising natural language. Creating E2E test scenarious with a natural language enlarges the audience that can undertand and use them. In that way product managers, customer representatives and any associate with a non-tehnical background can understand and comment on your test scenarious without knowing any programming language.

What is Cucumber and Gherkin ?

Cucumber is a testing tool that supports BDD (Behavior Driven Development). In BDD, users (generally Business Analysts, QA or Scrum Masters) first write test scenarious or acceptance tests that describe the behavior of the system from their side before developers write the code for the project.

You can see an example below;

In general term, Gherkin is business readable language which helps you to describe business behavior without going into details of the implementation. We can describe Gherkin language with three keywords; Given,When and Then . In cucumber syntax, all you write must be included under these three keywords (Given,When,Then).

There are some samples for how to use Given, When and Then syntax;

Syntax for Given;

Given - a test step that defines the 'context
Given I am on "/."

Syntax for When;

A When - a test step that defines the 'action' performed
When I perform "Sign In."

Syntax for Then;

Then - test step that defines the 'outcome.'
Then I should see "Welcome Tom."

What is Browserstack ?

BrowserStack is a cloud based testing environment for web and mobile applications, providing developers, with various level of expertise, the ability to test their applications in on-demand browsers, operating systems and a range of real mobile devices.

In our E2E test, Browserstack provided us countless opportunities to run our tests on multiple devices, even real ones. With such a powerful tool, our E2E tests covered many scenarios on many different devices.

Configuration for Browserstack ?

Configuring Browserstack for your E2E test scenario is simple. The Browserstack web page has a guide on how to implement your application to use for a test, and this page also contains configuration details in many different languages to import your configuration file.

A screenshot is attached below to give you an idea of how simple it is to add configurations for browser stack;

Quick Summary of What We Do

In this article, I tried to explain what BDD and Cucumber are and how to make effective use of them in your E2E tests, I shared my experience with Browserstack and how it can be useful in your E2E scenario.

Thank you for taking your time in reading my article. You are most welcome to share your opinions about E2E testing.

References:

Please refer to https://www.browserstack.com/ and https://cucumber.io/docs/guides/ for more information on these tools.

--

--

Sefa Bilgi
cloudnesil

Quality Assurance Engineer : Manuel and Automated Testing