Hacker News new | ask | show | jobs
by buro9 4632 days ago
I wouldn't mind a BDD tool written in Go, but not for this purpose.

What I would like is a tool that allowed testers and QA people to define tests using BDD for RESTful APIs.

Something along the lines of this syntax:

    Using https://example.com/myapi
        With access_token [accessToken]
        With content_type application/json
        When I create:
        {
          "somejson": true
          "foo": "bar"
        }
            Expect status 200
            Expect returnData.somejson = true
            Expect returnData.foo = "bar"
            Store returnData.id as myid
    And
    Using https://example.com/myapi/{{myid}}
        When I get
            Expect status 200
            Expect returnData.somejson = true
            Expect returnData.foo = "bar"
    And
        With access_token [accessToken]
        With content_type application/json
        When I update:
        {
          "somejson": true
          "foo": "foo"
        }
            Expect status 200
            Expect returnData.somejson = true
            Expect returnData.foo = "foo"
            Store returnData.id as myid
    And
        With access_token [accessToken]
        When I delete
            Expect status 200
    And
        When I get
            Expect status 404
I've seen a few things like this written in NodeJS, such as apieasy and vows. But nothing with this level of succinctness.

And I'd like it to be in Go as I'd like to just give a single binary to the testers (rather than an "install node, get project, fetch dependencies, resolve any issues, run the project").

When I read the headline, this is roughly what I hoped for. If I can find the time (unlikely), I'd build this. But then... maybe someone reading this knows something very close to this.

2 comments

At the boring enterprise projects we just use SoapUI for this type of testing.
I'm writing a project in Go at the moment. I'm actually using Python for exactly this kind of API testing. I see a DSL as obstructive and unnecessary, but that's my point of view.