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.
OMG, BDD! https://t.co/K2QlboH3jJ—
Jan Exner @ Adobe (@jexnerW4D) April 24, 2018
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.
BDD > TDD
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.
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.