【问题标题】:Javascript Library to Test API Endpoints [closed]用于测试 API 端点的 Javascript 库 [关闭]
【发布时间】:2013-05-13 01:32:36
【问题描述】:

我正在寻找一个简单的 API 来测试其余 API。我希望能够保持 mocha 和/或 jasmine 断言结构,同时链接 API 数据、动词等。

api( '/maker' )
   .put(
     return {
       name: 'Sample 1',
       type: 'cheese',
       country: 'United States'
     }
   )
   .failed()
   .succussed().
   .has(
     return {
       assert(1, 1)
     }
   );

【问题讨论】:

    标签: javascript api rest jasmine mocha.js


    【解决方案1】:

    supertest https://github.com/visionmedia/supertest 完全符合您的要求。

    【讨论】:

    • 我在尝试 frisby 和 supertest 后的笔记:与 frisby 相比,在 supertest 中“链接”异步请求要容易得多。另外,我喜欢 supertest 的默认 json 编码请求正文与 frisby 的 url-form 编码默认值。
    • Supertest 似乎还可以让你利用 jasmine 的 done 回调,这有助于串行运行异步测试。
    【解决方案2】:

    Frisby.js https://github.com/vlucas/frisby 是另一个。它是基于茉莉花的。

    【讨论】:

      猜你喜欢
      • 2010-10-10
      • 1970-01-01
      • 2018-12-10
      • 2016-04-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多