DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
View Events Video Library
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Integrating PostgreSQL Databases with ANF: Join this workshop to learn how to create a PostgreSQL server using Instaclustr’s managed service

Mobile Database Essentials: Assess data needs, storage requirements, and more when leveraging databases for cloud and edge applications.

Monitoring and Observability for LLMs: Datadog and Google Cloud discuss how to achieve optimal AI model performance.

Automated Testing: The latest on architecture, TDD, and the benefits of AI and low-code tools.

Related

  • The 10 Laws of Testing
  • Strategies To Automate Your Integration Testing
  • 7 Awesome Libraries for Java Unit and Integration Testing
  • Integration Testing: Why Developers Heed Attention to It

Trending

  • Send Your Logs to Loki
  • Snowflake vs. Data Bricks: Compete To Create the Best Cloud Data Platform
  • A Complete Guide to Open-Source LLMs
  • Leveraging FastAPI for Building Secure and High-Performance Banking APIs
  1. DZone
  2. Software Design and Architecture
  3. Integration
  4. The Difference Between BDD and Integration Testing

The Difference Between BDD and Integration Testing

Matthew Casperson explains how integration testing often "leaks" the technology that is being used while BDD is both simple and effective.

Matthew Casperson user avatar by
Matthew Casperson
·
Jun. 16, 16 · Opinion
Like (9)
Save
Tweet
Share
10.66K Views

Join the DZone community and get the full member experience.

Join For Free
Behaviour Driven Development provides teams with the ability to describe the desired interactions and outcomes of a process or application in something resembling plain English, and have those requirements translated into a test case that developers can validate their designs against. I think one of the reason why it is popular is because it takes the now accepted practice of writing automated tests for code and exposes it as a process that people other than coders can participate in.

A common implementation of BDD used by those creating web applications is the combination of Cucumber and WebDriver. Cucumber provides the Gherkin language, whose natural language syntax provides non-technical team members with the means to describe interactions and acceptance criteria. Cucumber then exposes these Gherkin commands as an extensible interface that in turn is used to automate a web browser via WebDriver.

A lot of people I speak to talk of Cucumber as a solution to their testing requirements. So when I was tasked with implementing Cucumber (under the assumption that I was also implementing BDD), I was surprised to find that there was no singularly popular Gherkin language I could replicate.

What I expected to find was an existing and accepted Gherkin language for interacting with a web page. While the fluent syntax of Gherkin makes it easy to describe interactions in terms of “When I click the button” or “When I open the web page." there are a lot of subtleties to these interactions that you will quickly run into when scripting the interactions with a real world web page. What happens if the element is optional (think A/B testing)? How do I identify elements that don’t have a nice ID or class type? How do you most eloquently describe the selection the third last element from a list of options?

I quickly found that there was no generally accepted Gherkin dialect for interacting with a web page. The documentation for Gherkin, and most tools that implement it, focus on how you would write your own dialect rather than trying to dictate what it should look like. Which is understandable given the broad scope of Cucumber and Gherkin, but still came as something of a surprise. Surely I’m not the only one trying to describe these kinds of web based interactions?

Introducing Modelling by Example articulated my dilemma better than most and cleared up a lot of confusion around the distinction between BDD and integration testing. The sorts of interactions I was asking Cucumber to perform were about the mechanics of using a web page, which is more about integration testing than BDD. BDD should be at a higher level again, describing processes in terms of business entities like “shopping baskets” or “product recommendations," and not at all concerning itself with element IDs or the position of items in a selection list.

The mistake I made was thinking about BDD in terms of how I as a developer would implement the feature. It was hard to see the distinction between “shopping basket” and “DIV with id of shopping_basket," because the two were the same thing in my mind, which meant that BDD and integration testing where much the same thing as well.

Ironically, there is no test that provides a concrete distinction between unit testing, integration testing, acceptance testing and BDD. They all exist on the same continium with blured lines between one and the next. But the easiest way I can describe BDD to myself is that it is the explanation of a process that I would give to a 5-year-old. This is not to say that BDD is childish, but that it should be at a high enough level conceptually that you don’t need a computer science degree to make the connection between “I click on the div with the ID of shopping_basket” and “I open my shopping basket."

If your tests leak the details of the underlying technologies being used, you are mostly likely writting an integration test. If you want to do BDD, then your tests should able able to result in three different and perfectly valid solutions, should you ask a desktop developer, web developer, or mobile developer to implement them.

Integration testing Integration

Published at DZone with permission of Matthew Casperson, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • The 10 Laws of Testing
  • Strategies To Automate Your Integration Testing
  • 7 Awesome Libraries for Java Unit and Integration Testing
  • Integration Testing: Why Developers Heed Attention to It

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends: