unit-testing - 在grails中模拟外部http请求

标签 unit-testing rest grails groovy mocking

我正在使用RestBuilder(LINK)对外部服务进行REST调用。
现在,我要模拟http请求进行单元测试(或集成测试,无论如何)的服务,该服务处理与该外部服务进行通信的所有逻辑。

有谁知道如何模拟http请求或此RestBuilder?

谢谢你的帮助!
伊万

最佳答案

这种测试称为“功能测试”。有许多插件可以帮助您完成此任务:

http://www.grails.org/plugin/functional-test

http://www.grails.org/plugins/tag/functional

关于unit-testing - 在grails中模拟外部http请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19116571/

相关文章:

python - 如何使用 Travis-CI 运行 Tox

java - Spring @ExceptionHandler 返回 HTTP 406

java - 当端点非常相似时,路径参数与查询参数

mongodb - 尝试使用GORM访问MongoDB数据时出现错误

java - 为单元测试序列化对象

java - 编解码算法联合测试

grails - 从 Grails Tablib 返回 bool 值?

grails - Grails URL映射多个 View

Angular 5 : How do I deal with the dependencies of the dependencies of a component while unit testing?

html - 发布 html 表单数据重定向