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
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
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

Because the DevOps movement has redefined engineering responsibilities, SREs now have to become stewards of observability strategy.

Apache Cassandra combines the benefits of major NoSQL databases to support data management needs not covered by traditional RDBMS vendors.

The software you build is only as secure as the code that powers it. Learn how malicious code creeps into your software supply chain.

Generative AI has transformed nearly every industry. How can you leverage GenAI to improve your productivity and efficiency?

Related

  • Mocking and Its Importance in Integration and E2E Testing
  • The Cost-Benefit Analysis of Unit, Integration, and E2E Testing
  • The 10 Laws of Testing
  • Strategies To Automate Your Integration Testing

Trending

  • Using Python Libraries in Java
  • Bridging UI, DevOps, and AI: A Full-Stack Engineer’s Approach to Resilient Systems
  • What’s Got Me Interested in OpenTelemetry—And Pursuing Certification
  • Developers Beware: Slopsquatting and Vibe Coding Can Increase Risk of AI-Powered Attacks
  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.

By 
Matthew Casperson user avatar
Matthew Casperson
·
Jun. 16, 16 · Opinion
Likes (9)
Comment
Save
Tweet
Share
11.3K 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

  • Mocking and Its Importance in Integration and E2E Testing
  • The Cost-Benefit Analysis of Unit, Integration, and E2E Testing
  • The 10 Laws of Testing
  • Strategies To Automate Your Integration Testing

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • 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:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!