【问题标题】:jsonPath() not fetching value, restassuredjsonPath() 没有获取值,放心
【发布时间】:2018-09-25 09:30:32
【问题描述】:

代码如下

    Response response = null;  
    try {  
    response =given().log().everything().when().get().
    then().contentType(ContentType.JSON).extract().response();  
    String a = response.jsonPath().getString("aType");  
    String b = response.jsonPath().getString("bType");  
    System.out.printn(a+b);  
}

但是我在 print 中看到 null 输出而不是 value,有什么线索吗?

【问题讨论】:

  • 您确定您的回复中有“aType”和“bType”之类的字段,能否请您提供一个示例回复。

标签: json rest-assured


【解决方案1】:

已解决。我应该访问完整路径。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-01-11
    • 2017-12-21
    • 1970-01-01
    • 2014-04-07
    相关资源
    最近更新 更多