BDD > TDD – Site Infrastructure Test v4

Back towards the end of April, a test manager at one of my clients listened to me talk about the test framework I had built over the last couple of years. He was supportive and eager to run tests.

He also very casually asked me why I hadn’t considered “Behaviour-driven development”, BDD, instead of TDD. I had no answer, because, frankly, I had never heard of BDD.

At the hotel, later that evening, I spent some time reading about BDD and had a pretty extreme “aha!” moment.

There is something sublime about finding a new way of doing things, particularly if that new way is smooth and easy. I spent three days to essentially rebuild the whole framework using cucumber, and the result was quite simply lightyears ahead of my old code.


In order to explain why I think BDD blows away TDD for this use case, let me just show you a screenshot of my old test description JSON file, and a feature file in the new version using gherkin syntax.

Test descriptions – old vs new
While the old JSON syntax does the job, the new one is much more readable. And given that I am asking Analysts or Marketers to write and maintain the tests, that is important.

I think that any non-technical person should be able to write features using gherkin.

Behind the scenes, the cucumber framework now handles all test creation and there is no need anymore for a bespoke test suite generator. Consequently, the size of the code overall has reduced from 2248 to just 512 lines of code.

I have replaced the old stuff in the github repository. There is simply no reason to use clunky, old code if instead you can use much simpler stuff.

Check out the README for syntax tips, specifically for the phrases you have available to write features. Given how simple it is to write those tests with cucumber, I’m open to any ideas!

Have fun testing

And do let me know if you preferred the old framework. I can for the life of me not see why you would, but I’m open to arguments.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.