-1

First of all, I looked at another question, BDD framework for the frontend. The question has gone on entirely different direction.

BDD is not about Cucumber or Plain english tests names. (Jasmine/Mocha and most others achieve how to describe the behavior.

BDD is actually about how we test a behaviour rather than implementation. And this is where I am looking for tools that can ease the setup for such tests. jasmine and jest can test the rendered content and achieve BDD, But the setup is excessive and discourages people from doing TDD.

Selenium on the other hand is pure BDD but slow and difficult to write and maintain for each component. Is there a tool that takes a mid-path?

1 Answer 1

1

Selenium is not a BDD tool. It's an automation tool. They often get confused though! The usual layering goes like this:

BDD steps in plain English
            |
"Glue" that ties to a BDD framework
            |
Steps in code (in whatever BDD framework in whatever language you choose)
            |
     Page Objects
            |
       Automation           

For web the Automation is often Selenium; there are other tools for other mediums like Desktop. BDD frameworks are things like Cucumber, JBehave, SpecFlow, which usually interpret Gherkin syntax and match it up to code steps. You could use Selenium without Cucumber, and vice-versa, but it's very common to see them used together.

With respect to easing the setup, often people miss out the Page Object pattern, which represents the capabilities of a page or widgets on a page, making each component much easier to handle and hiding the automation details away from the steps. This could make the automation side of things easier for you particularly in terms of maintenance.

It's also not necessary to use a BDD framework. You can use plain old unit-testing frameworks, as long as you can call through to the automation. I like to build my own DSL which is English-like and perfectly readable by non-technical stakeholders (note that I still usually use the Page Object pattern too). This could make the BDD side easier too.

If you have a very thin front-end you can also reasonably test at the system API level, bypassing HTML automation entirely. Note though that the front-end will still need testing.

2
  • Interesting how PageObject was actually popularized by Selenium Commented Aug 3, 2023 at 13:05
  • 1
    @CodeNameJack It was popularized by folks involved in Selenium and the web automation community. Turns out some of them are the same folks who were involved in popularizing BDD too!
    – Lunivore
    Commented Aug 7, 2023 at 23:07

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.