简体   繁体   中英

Clojure version of Behat?

In the past, for PHP project's, I have used Behat in conjunction with the api-extension to write component level tests. Behat shares a common philosophies with cucumber. I would therefore like to known if there is an equivalent api extension I could use for cucumber in a Clojure project?

This is the kind of test I would like to create:

Feature: MyFeature
Scenario: do somthing
      Given the request body is:
      """
      {
        "key": "val"
      }
      """
      And the "Content-Type" request header is "application/json"
      When I request "/route" using HTTP POST
      Then the response code is 200
      Then the response body contains JSON:
      """
      {
          "meta": {
              "status": "@variableType(string)"
          },
          "data": {
              "key": "@variableType(integer)"
          }
      }
      """

So I think what you are looking for is a BDD framework that implements Gherkin in some way (as Behat does). The Cucumber framework, which you mention, does just that, and there exists a Clojure implementation which you can see here: https://github.com/cucumber/cucumber-jvm-clojure

I think this is basically what you are looking for.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM