【发布时间】:2014-02-19 23:02:27
【问题描述】:
我刚刚获取了functional testing plugin 的最新版本,至少从文档来看,它的焦点发生了一些变化。这不是一件坏事。 HtmlUnit 集成很好。但是现在,文档中没有任何关于 Web 服务的 RESTful 测试的内容。但是,我过去对 functionaltestplugin.FunctionalTestCase 所做的事情仍然有效,这很棒。
例如:
void testCertifyEmployerCertifierNotFound() {
post('/employerCertification/certifyEmployer') {
headers['Content-Type'] = 'application/json'
body {
"""
{
'employerName': 'ACME',
'certifierExteralId': '1234556',
'certifyingUserId': '123445'
}
"""
}
}
assertStatus 200
assertContentType "application/json"
def model = this.response.contentAsString
def map = JSON.parse(model)
assertFalse(map.success)
assertNotNull(map.errorCode)
assertTrue(map.errorCode == EmployerCertificationService.ERROR_RESPONSE.CERTIFIER_NOT_FOUND.toString())
}
这个插件仍然是用于功能 Web 服务测试的“事实上的”插件吗?我上面的方法仍然有效吗?
【问题讨论】: