Betamax没有在Grails中记录对RESTClient的调用
我有一个Betamax测试,我正试图将其配置为拦截对使用RESTClient的web服务的调用。对web服务的调用未被记录。我的测试代码如下所示:Betamax没有在Grails中记录对RESTClient的调用,grails,grails-2.0,spock,betamax,Grails,Grails 2.0,Spock,Betamax,我有一个Betamax测试,我正试图将其配置为拦截对使用RESTClient的web服务的调用。对web服务的调用未被记录。我的测试代码如下所示: @Betamax(tape = 'pending_transfer_success') void "test createPendingTransfer"() { BetamaxRoutePlanner.configure(restClient.client) BetamaxHttpsS
@Betamax(tape = 'pending_transfer_success')
void "test createPendingTransfer"() {
BetamaxRoutePlanner.configure(restClient.client)
BetamaxHttpsSupport.configure(restClient.client)
when:
Transfer transfer = service.createPendingTransfer(
beneficiaryFirstName, beneficiaryLastName, beneficiaryUserEmail, lineItemsIdsToTransfer)
then:
...
}
在setup()方法中,我正在配置RESTClient,如下所示:
restClient = new RESTClient("${grailsApplication.config.acme.account.api.url}/")
service.restClient = restClient
该应用程序是Grails2.2.3应用程序,测试使用Spock编写。如果您能帮助解释为什么不记录电话,我们将不胜感激。您使用的是什么Betamax版本?您是否有其他正在成功录制的测试,或者这是您第一次尝试的测试?这是单元测试还是集成测试?Betamax版本是1.1.2。我们还有另一个使用Betamax的测试,但它不是Spock测试(它扩展了GroovyTestCase)。这个测试是一个Spock单元测试。嗯,Spock的执行方式应该不会有太大的不同。另一个测试是否也引用了相同的
服务
?否,另一个测试正在调用不同的服务,并使用HTTPBuilder而不是RESTClient。我是否正确配置了RESTClient?我注意到在您的示例应用程序中,您使用了一个名为co.freeside.betamax.ProxyConfiguration
的类。我看不出来。在最新版本的Betamax中是否删除了该选项?