2

有没有人使用量角器和茉莉花来做 API 测试。在搜索这个时,我了解到使用 frisby.js 我们可以进行 API 测试。但是,我的疑问是量角器或茉莉花是否直接支持/提供API测试功能。有人试过这个吗?如果是这样,我需要遵循什么方法?

提前致谢。

4

1 回答 1

1

Protractor is meant for e2e testing and e2e tests are supposed to test the flow of an application from user standpoint, in spite of that you should test your API calls not directly but rather through testing user actions and if actions perform as intended it means the API that they rely on work.

If you want to do tests for API to catch errors early without having to run full e2e test suite you should use frisby.js as you've mentioned to confirm all APIs are A-OK and you can follow then with e2e tests when you are sure that all should be working.

IMO it's better to use the tools for what they were designed.

于 2016-05-20T07:44:19.667 回答