我的代码:
@upload @offline
Feature: upload one mp3 file
Background:
* url 'http://xx.test.com'
* def Sign = Java.type('token.Sign')
Scenario:
* def ck = Sign.execute(false)
* print ck
* path '/rest/n/test/up'
* cookie userId = ck.id
* cookie tes.api_st = ck.st
* cookie did = ck.did
* multipart field title = 'hello'
* multipart file ringtone = { read: '123.mp3', filename: '123.mp3', contentType: 'audio/mp3' }
* method post
* status 200
* match response contains { result: 1 }
然后mvn test -Dtest=xxx
将输出以下信息:
19:39:57.073 [main] ERROR com.intuit.karate - java.lang.ArrayIndexOutOfBoundsException: -1, http call failed after 1542281997073 milliseconds for URL: http://tianou123.test.gifshow.com/rest/n/test/up
19:39:57.073 [main] ERROR com.intuit.karate - http request failed: -1
19:39:57.925 [main] WARN io.sentry.dsn.Dsn - *** Couldn't find a suitable DSN, Sentry operations will do nothing! See documentation: https://docs.sentry.io/clients/java/ ***
Failed scenarios:
xxx/upload.feature:8 # Scenario:
所以,我不知道为什么。因为请求没有到达后端服务器。
使用邮递员,请求可以正常运行。