mıray tosun yurtseven | product manager
Nowadays, to prove the quality of a job, tests must be done immediately after the development. Tests are one of the most important evidences that prove a job is completed as desired. The other important evidence is the test carried out with business units. Business units test their usage habits according to the product they demand and their operations. Basically, they do their own behavioral tests. This approach brought a new test approach into our lives.
In these days, most people use BDD(Behavior Driven Development) which is an alternative method for TDD (Test Driven Development). Most people think that TDD is an expensive software development process and they prefer to use BDD.
The fact that the software development and test automation processes with TDD are considered to be costly, it shouldn’t be ignored that high quality software are developed with the TDD method. In today’s conditions, the necessity of completing customer demands as quickly as possible and in the meantime using a common language between Business Units and IT led to using BDD to solve communication problems.
In fact, as in all approaches, the main issue that the BDD focuses on is the production of quality code. In this context, in addition to solve communication problems between two different departments, BDD helps to find the bugs of a product very quickly with customer behavior tests.
There are two important workhops; first is SBE (specification by example), the second is TDD (test-driven development). In the first workshop (SBE), IT department representatives and Business unit representatives talk about a new product and its features, Business unit representatives give an example of where they want to use it and why they want to use it. The real purpose of this workshops is to decide how the system should behave in different situations . The second (TDD) workshop is carried out by runing the written automation codes to prove that the software has the desired behavioral functions. The test results are observed immediately right after runing codes, so that any inadequacy can be detected and turn into actions.Test automation for BDD has very simple writing method. Given-When-Then are the three titles of the test scenarios. Given is the heading of the test scenario to explain what customers want to do. When is the timing detail of the action . Then is the explanation of the result of this action. For example, consider that we wrote the below steps for user to login to the system:
Given: User types a wrong password to the password field,
When: clicks the submit button,
Then: the system gives an alert message about the wrong password.
Another simple BDD writing method is Role-Feature-Reason matrix. Role description begins with “As a…”, for feature “I want…” and finally, “so that…” for the Reason. For example;
As a: retail customer,
I want: I want return the products I bought in 14 days.
So that: So that I will be able to payback.
The most important feature of the BDD is providing a simple platform where the codes are written in common language that lets everyone to read and write.. Due to its approach and creation of a common point for each stakeholders, it has become very popular recently and started to be used in many sectors.