Our blog

Automated Testing using BDT (Behavior Driven Testing)

what is BDD testing? Let’s go back to history first!

Behavior Driven Development is well-accepted and current methodology in agile projects. Behavior Driven Testing (BDT) is a lesser known companion of Behavior Driven Development (BDD). BDT can be used without BDD.

In software engineering, behavior-driven development (abbreviated BDD) is a software development process based on test-driven development (TDD). Behavior-driven development combines the general techniques and principles of TDD with ideas from domain-driven design and object-oriented analysis and design to provide software developers and business analysts with shared tools and a shared process to collaborate on software development.

Although BDD is principally an idea about how software development should be managed by business interests and technical insight, the practice of BDD does assume the use of specialized software tools to support the development process. Although these tools are often developed specifically for use in BDD projects, they can be seen as specialized forms of the tooling that supports test-driven development. The tools serve to add automation to the ubiquitous language that is a central theme of BDD.

Behavior-driven development was developed by Dan North as a response to the issues encountered teaching test-driven development:

  • Where to start in the process
  • What to test and what not to test
  • How much to test in one go
  • What to call the tests
  • How to understand why a test fails

At the heart of BDD is a rethinking of the approach to unit testing and acceptance testing that North came up with while dealing with these issues. For example, he found that unit test names should be whole sentences starting with the word should and should be written in order of business value. Acceptance tests should be written using the standard agile framework of a User story: “As a [role] I want [feature] so that [benefit]”. Acceptance criteria should be written in terms of scenarios and implemented as classes: Given [initial context], when [event occurs], then [ensure some outcomes].



BDD & BDT Advantages

It involves getting stakeholders and delivery team with different perspectives onto the same page and ensuring that all have the same expectations. BDD starts with a business goal and goal that translates to features and stories.

The goal of BDT is a business readable and domain specific language that allows you to describe a system’s behavior without detailing how that behavior is implemented.

In BDT, Tests in the form of plain text features descriptions with scenarios are typically written before anything else and verified by the non-technical stakeholders.

BDD Process
BDD Process
Cucumber for BDD

Cucumber is optimized for BDD, by its support for particular set of interactions between team members and stakeholders.

Cucumber can execute plain-text functional (feature) specifications as automated tests. The language that Cucumber understands is called Gherkin.

Cucumber supports writing specifications in about 30 spoken languages, making it easy for teams outside of English-speaking territories or those working on internationally targeted software to deliver better.

Other salient features include:

  • Defining executable specifications in different ways like lists, prose and tabular data
  • The plain text files can be stored in any version control system
  • Cucumber works with Ruby, Java, .NET, Flex or web applications written in any language
  • Can be integrated with all the most popular web testing libraries
  • Cucumber is both BDD in the form of feature descriptions and scenarios and TDD in the form of step definitions
  • Provides a layer of abstraction between the required behavior and the app implementation

The other tools that support BDD are

  1. CCSpec
  2. C++ – CppSpec
  3. C# .NetNSpec
  4. NetNBehave, NSpecify & SpecFlow (for .NET, Mono & Silverlight)
  5. Groovy – GSpec
  6. JavaJBehave, JDave, beanSpec, Instinct, GivWenZen (Java and FitNesse), Cuke4Duke, accept4j.
  7. Javascript – JSSpec,
  8. PHPPHPSpec
  9. Python – Specipy, spec plugin for nose
  10. RubyRSpec, Shoulda, test-spec & bacon,

support BDD

Behavior Driven Script Development

  • Specify the behavior looking at the system from the outside.
  • Collaborate and come up with a good and clear set of Acceptance Criteria.

Expected Functionality:

The customer should be able to withdraw money from his account.

Given the account has balance of INR 10000

When the customer requests INR 5000

Then the account is debited by INR 5000

Expected Behavior Driven Test:

It is an approach to behavior driven testing. Work towards the big picture.

Given the account is in credit

And the dispenser contains cash

When the customer requests cash

Then ensure the account is debited

And ensure cash is dispensed

And ensure the card is returned


Behavior Driven Testing can be adopted for Mobile Test Automation

Most of the Enterprise clients are following scrum product development. Historically, test automation has not met with the level of success in the developmental phases (TDD & paired programming). Most often this is the result of inappropriate perceptions of the effort and resources necessary to implement a successful, long-lasting automation framework development. Why is this, we might ask? Well, realizing that we must develop reusable test strategies is no different than the reusability concerns of any good application development project. As we set out on our task of automating test, we must keep these past lessons upfront.

“One test case for both Manual and Automation testing”

Here we try to get all the answers — BDT framework , we should focus our automation framework to deal with the common components that make up our unique automation framework that can useful in easy development of test cases as such as Manual tester can do with Library keywords.

Calabash + Cucumber

Nowadays, Calabash Open Source mobile automation testing tool is getting wide attention in market due to their automation capabilities for native & hybrid Android & iOS apps. User can write tests or features on top of BDT framework using Cucumber.


Interested in our Development Services?

Contact Apexon +1 408-727-1100

By submitting this form, you agree that you have read and understand Apexon’s Terms and Conditions. You can opt-out of communications at any time. We respect your privacy.

By submitting this form, you agree that you have read and understand Apexon’s Terms and Conditions. You can opt-out of communications at any time. We respect your privacy.

Other stories you may enjoy...

One Year In: Technology Success Stories from the Pandemic

This time last year, US companies were forced to face a new and unsettling reality: business as usual was no longer an option. I wrote then about how businesses could shift their...

How to Work with Your Remote Development Team

Working with remote teams to develop and release new products has become the norm for almost all aspects of software development.  Nowhere is that more true than in the mobile...

Think You Know Your App Dev Needs? Think Again.

The pace of change in mobile app development has been mind-blowing. Here at Apexon, we’ve been working on mobile apps since their inception. With every project we learn...