【问题标题】:No signature of method: io.restassured.internal.ContentParser.parse()没有方法签名:io.restassured.internal.ContentParser.parse()
【发布时间】:2020-05-24 18:03:20
【问题描述】:
线程“主”groovy.lang.MissingMethodException 中的异常:没有方法签名:io.restassured.internal.ContentParser.parse() 适用于参数类型:(io.restassured.internal.RestAssuredResponseImpl, io.restassured. internal.ResponseParserRegistrar...) 值:[io.restassured.internal.RestAssuredResponseImpl@6f2cfcc2, io.restassured.internal.ResponseParserRegistrar@7f6f61c8, ...]
可能的解决方案:wait()、any()、grep()
【问题讨论】:
标签:
api
automation
rest-assured
qa
rest-assured-jsonpath
【解决方案1】:
我猜你正在使用4.3.0 以上的 RestAssured 版本。如果你也在使用 spring-boot,RestAssured 需要的依赖版本可以关闭,为了解决这个问题,你需要手动指定它们:
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<version>${rest-assured.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>json-path</artifactId>
<version>${rest-assured.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>xml-path</artifactId>
<version>${rest-assured.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy</artifactId>
<version>${groovy.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-xml</artifactId>
<version>${groovy.version}</version>
<scope>test</scope>
</dependency>
Groovy 至少应位于 3.0.0 且 RestAssured 应高于 4.3.0,但请查看您阅读本文时的最新版本。