Behaviour Driven Development for Quality Assurance in Blibli.com Agile Environment

Ivan Widyan
Blibli.com Tech Blog
6 min readDec 22, 2019

Have you heard of BDD before?

Do you know what QA does in an IT company?

QA (Quality assurance), especially in IT companies, will generally do software testing. Software testing is an activity to make sure the result has equaled the expected outcome. Software testing is also ensuring if a software is free from defects which can involve one or more system components.

This work is necessary to identify errors, gaps, or requirements that are still less than desired. This result can be achieved manually or using automated tools.

image source: https://www.enukesoftware.com/blog/why-mobile-app-testing-cost-surpasses-the-development-cost.html

Testing in Agile

One of the development cycles that you might hear often is Agile, but what is Agile?

Agile is a process that helps a team to give a fast and unpredictable response from the feedback they receive in a project. This process allows an opportunity to assess the direction of a project in the development process.

image source: https://albedo.dev/development/agile-software-development/

.The team will evaluate the project in a regular meeting called sprints/iterations. This method will allow companies to make a highly valuable product so they can stay competitive in the market.

Below are the examples of software development cycle examples that relate to the topics we will discuss today.

Test-Driven Development (TDD):

  • TDD is a cycle for creating test cases, coding, and then with some refactoring
  • Focus more on implementing a system and usually use technical topics that are difficult for non-IT users to understand

Acceptance Test-Driven Development (ATDD):

  • Capture requirements in acceptance tests and use them to drive development
  • Then ascertain whether the system has done the desired requirements

Behavior Driven Development (BDD):

  • Customer-focused, how the system works from the perspective of the developer and customer
  • We will write the test in a non-technical language that everyone can understand (e.g., a domain-specific language like Gherkin)

BDD combines the principles of TDD and ATDD and forms a new approach to building an understanding of what kind of software you want to develop by discussing rules, examples, and executable specifications.

In agile, BDD has a vital role because BDD is a development process that is in line with the agile methodology in the process of development and testing. BDD combines business users, QA, & SE (Software Engineer) or even customers of a software product to share their knowledge and make plans for testing to be done.

image source: https://www.belatrixsf.com/blog/how-improved-our-sw-dev-proc-with-bdd

That is the most critical stage in BDD. Some people, especially business users, developers, & testers, gather and identify the expected behavior of their products by discussing some features (examples) and making executable specifications commonly called discovery workshops. We can use the “feature mapping” approach to analyze the behavior of a product effectively.

Feature mapping is a simple collaborative practice designed by John Ferguson Smart to help teams create excellent executable specifications.

  1. Story: Define a feature or take it from the backlog
  2. Actors: Understand what actors are involved in the story
  3. Flow and tasks: Break these features into several tasks to identify the main flow
  4. Examples and rules: Identify examples that illustrate flow variations. Ask questions like “But what if, for example …”; “Moreover outcomes that can be produced or can occur”; and use the answer to create new examples. Use rules to explain and provide context for your samples.
  5. Rinse and repeat: To add rules or other examples
  6. Create Executable Specifications: Automate the main high-level flow with its steps

Feature Mapping

Let’s try to imagine the discovery workshop taking place with business, QA, & SE. They want to implement a new feature, which is the login profile in their system.

Then they write an outcome of features they discuss in high-level features and scenarios in business languages. This process is very similar to agile story writing.

Feature: Login Profile
As a user of the Blibli web application
I want to login my member profile using my credentials
In order to access privileges as a member

Below is an example feature for login to an application, and we will write it using feature writing, in general, that has the format: As a, I want to, and in order to. Note that this is a very high level and abstract. In this case, there is only one actor, the user.

Now we will break the feature into several scenarios, success logins, and failed logins.

Feature: Login Profile
Scenario: Successful login
Scenario: Failed login using wrong credentials

To execute a story, we must determine the steps and rules involved in each story. For example, let’s take a successful login scenario. Before logging in, the user must be on the Blibli.com homepage and navigate to the login panel first. This step is a condition (background scenario) that helps the expected scenario we want, which is a successful login. Let’s look at the steps:

Background: User login via Blibli Home page
Steps:
1. Go to Blibli.com home page
2. Navigate to login panel
3. See login options

Executable Specification (Story)

Now the time has come to realize the features and scenarios into the executable specification. We must get input from developers and testers to convert these stories and scenarios into executable steps in the Gherkin Language format (Given / When / Then). And keep in mind that business users must agree with these steps.

Background: User login via Blibli Home page
Given I am on the Blibli.com homepage
When I click on the login button
Then I should see the login panel

Scenario: Successful login
When I fill the email using correct data
And I fill the password using correct data
And I click on the login button
Then I am on the profile page
And I will see logout button

We can see that the results of this executable specification can be understood both from the QA, the developer and from the Business user himself. Then based on this executable specification, the developer and QA will start working, respectively.

From the QA side, before starting to develop automated testing using BDD, there are several tools that you must have first.

BDD Test Framework: Tools that help define application behavior in plain and straightforward languages ​​that are defined using DSL: e.g., Cucumber (Gherkin), Jbehave (Gherkin), and then there is Serenity (Gherkin).

Test Runner: Library or tools to help automate and run the behavior test. e.g., TestNG (Java), jUnit (Java), Mocha (JavaScript), and Rest Assured.

Optional IDE plugins: For managing BDD development, several IDEs can support BDD coding. For example, Cucumber plugin that is on IntelliJ IDEA and Eclipse IDEs.

--

--