Live data from Hacker News

Cucumber lets you write automated tests in plain language

cucumber.io

11–20 of 76 posts

Re: Cucumber lets you write automated tests in plain language

#11
post #6

IME this allows the BAs who are writing ticket requirements to also write tests. It works. The dev may have to tweak the tests to get them to compile, but it an org that is willing to spend quite a bit of money on testing (e.g. public sector) this is a format that devs and BAs can read.

IME? BA?

[deleted]

Re: Cucumber lets you write automated tests in plain language

#12
post #6

IME this allows the BAs who are writing ticket requirements to also write tests. It works. The dev may have to tweak the tests to get them to compile, but it an org that is willing to spend quite a bit of money on testing (e.g. public sector) this is a format that devs and BAs can read.

IME? BA?

Most likely "In my experience" and "business analyst"

Re: Cucumber lets you write automated tests in plain language

#14

In my misspent youth I've tried to introduce Cucumber/Gherkin a couple of different times but it's something with a deceptive promise. The preconditions are that you have domain experts or business people interested and willing to engage in writing or reviewing these tests. Unless you have this and it's something that those people are going to sustain when the going gets tough you're just making writing tests harder…

Ding ding ding. If it's not product / other people writing the specs, your job as a developer is now:

- write specs in a cucumber fashion

- write parsers to go from cucumber to whatever objects / data you expect

- finally write your tests

Re: Cucumber lets you write automated tests in plain language

#15
It sounds great on the label, but what you’ll end up with are single-use matchers for almost every line of your cukes, annoyance maintaining the regexes that map your cukes to the actual test implementation, and the “non-technical” people won’t be maintaining the cukes anyway. Sure, let them specify the cukes if they want, but then translate them into regular unit tests or specs and forget maintaining them.

Just like all the other no-code inventions out there, they fail to reckon with the fact that essential complexity isn’t a problem with programming language syntax.

Re: Cucumber lets you write automated tests in plain language

#16

In my misspent youth I've tried to introduce Cucumber/Gherkin a couple of different times but it's something with a deceptive promise. The preconditions are that you have domain experts or business people interested and willing to engage in writing or reviewing these tests. Unless you have this and it's something that those people are going to sustain when the going gets tough you're just making writing tests harder…

The problem isn't really that the domain experts or business people aren't interested in reviewing these tests. The problem is that the cucumber language is just very, very poorly suited for writing anything beyond very basic specifications.

In practice when people try to use it for anything semi-complex they inevitably end up either writing very vague tests or repetitive tests, neither of which are of much interest to stakeholders.

I've used docs generated from hitchstory for having conversations with stakeholders. I've also shared semi-human readable unit and e2e tests - especially when it's, say, JSON snippets in an API with technical stakeholders.

Unfortunately, except for a few domains where specs can be expressed very concisely, cucumber isn't suitable for that.

Re: Cucumber lets you write automated tests in plain language

#17

In my misspent youth I've tried to introduce Cucumber/Gherkin a couple of different times but it's something with a deceptive promise. The preconditions are that you have domain experts or business people interested and willing to engage in writing or reviewing these tests. Unless you have this and it's something that those people are going to sustain when the going gets tough you're just making writing tests harder…

What is it about Cucumber that is so attractive to early in career engineers (myself included)? Is it the naive belief that others, non-engineers even, will actually want to read or write your tests? It's great in theory, but like many ideologies that attract young people, political or otherwise, its promise of egalitarian test authorship rarely holds up in practice. My experience is that it ends up as an extra abstraction layer to maintain.

Re: Cucumber lets you write automated tests in plain language

#18
I've always thought this looks cool but then you realize the whole thing is driven by regexs on the "plain english" and I recoil in horror

    Given /^a nice new bike$/ do
      expect(bike).to be_shiny
    end

so I've traded translating business requirements into specs for trying to regex against business requirements - and probably a lot of back and forth telling people they wrote their gherkin wrong

have never actually tried it for that reason - it just seems worse in every way

Re: Cucumber lets you write automated tests in plain language

#19
Aren’t syntaxes and semantics purposeful? Isn’t knowing the proper syntax and semantic structure part of how we design good software? I don’t understand the desire for “plain language” beyond the notion that ignorant people want to stay ignorant.

Re: Cucumber lets you write automated tests in plain language

#20

It sounds great on the label, but what you’ll end up with are single-use matchers for almost every line of your cukes, annoyance maintaining the regexes that map your cukes to the actual test implementation, and the “non-technical” people won’t be maintaining the cukes anyway. Sure, let them specify the cukes if they want, but then translate them into regular unit tests or specs and forget maintaining them. Just like…

[deleted]
Post reply on HN