douye2036
2018-11-27 14:05
浏览 96
已采纳

Chatjure版的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)"
          }
      }
      """

图片转代码服务由CSDN问答提供 功能建议

过去,对于PHP项目,我将Behat与 api-extension 编写组件级别测试。 Behat与黄瓜有着共同的哲学。 因此,我想知道在Clojure项目中是否有可用于黄瓜的等效api扩展?

这是我想要创建的测试类型:

 功能:MyFeature 
Scenario:do somthing 
给定请求正文为:
“”“
 {
”key“:”val“
} 
”“  “
并且”Content-Type“请求标头是”application / json“
当我使用HTTP POST请求”/ route“时
然后响应代码为200 
然后响应主体包含JSON:
”  “”
 {
“meta”:{
“status”:“@ variableType(string)”
},
“data”:{
“key”:“@ variableType(integer)”\  n} 
} 
“”“
   
 
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • doushi5024 2018-11-27 20:08
    已采纳

    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.

    已采纳该答案
    打赏 评论

相关推荐 更多相似问题