9 ms·
I had a similar issue when I first picked rspec up over a decade ago. At first I was drawn to the allure of an approach that would have the tests better match t
by glenngillen 5y ago
I had a similar issue when I first picked rspec up over a decade ago. At first I was drawn to the allure of an approach that would have the tests better match the intention of a customer (more general BDD, and not just rspec). You’d sit down with the customer and write down what they wanted to happen in natural prose, the tests would (almost) write themselves, and the opportunity for misalignment or miscommunication would vanish!
Except it wasn’t natural prose. It ended up being ham-fisted attempts to write “as a user, when I…” style paragraphs that most closely matched whatever marchers already existed. Then there’s be nuance in the differences so you’d have to write specific assertions anyway. In the end it rarely felt like magic to me, and that I spent just as much time if not more writing and maintaining the test implementation as I’d always done. Just now with an extra layer of abstraction and misdirection.
At some point I realised the value wasn’t in BDD, it was just the conversations it was forcing. Nobody outside our team cared if the tests were green if it didn’t actually give them the outcome they wanted. There was no pointing feeling like you’d won on a technicality. So I switched back to implementing tests the way that was quickest and easiest for us. And writing the other forms of documentation others needed, in the formats that were best for them.
- deleted 5y ago[deleted]
- drewcoo 5y ago> “as a user, when I…” That's not RSpec. That's the evil cuke-y form of BDD.
- tibbon 5y agoI recall this being all the rage for a few years.
- jspash 5y agoI remember struggling with this also. But if anything good came out of that era, it was Given.. When.. Then.. which is the template I still use to this day. It works for developers writing the specs, new devs reading them and surprisingly it also works for non-techie types who request features. If a request comes in that doesn't state those three things, I'll walk the person through it. And occasionally they will have an epiphany of sorts. An enlightening moment where they finally "get it". They get where communication has suffered in the past. I really love that part of my job. It's like being a translator between humans and aliens where previously they both just wanted to eat each other. But due to G/W/T they now want to build interstellar highways together and have hybrid babies.