Hacker News new | ask | show | jobs
by The_Pherocity 4371 days ago
I wouldn't call this a BDD framework yet. It's speckled with both standard assertions and semantic assertions, and an "It" function that simply takes a block and a string. I can replicate this with using underscores in my test function names and avoid the complexity. Not trying to be a jerk, but what we should be driving for is something closer to:

    func Describe("The system I want to Test"){
        When("I click the red button")
        Then("I should see the light turn on")
        And("I should see 4 lights")
    }

    func Step("I click the red button"){
       buttons["red"].click
    }

    func Step("I should see the light turn on"){
       lights.on.should().be_true
    }

    func Step("I should see (\d+) lights"){
        lights.count.should().be(4)
    }
1 comments

it depends on what you consider "BDD". The linked library is nearly identical to Cedar ( https://github.com/pivotal/cedar ), which is, in turn, nearly identical to rspec ( http://rspec.info/ ). Both of these libraries are very much considered BDD. You seem to be advocating something closer to cucumber/gherkin?
Maybe somewhere in the middle, but fair point. I have my bias for the style change, though that was a distraction from my point. It's premature, and in it's current form, doesn't add much value.