@Test public void test2 () { given() .param("q","9789652868374") .get("https://www.googleapis.com/books/v1/volumes") .then() .contentType(ContentType.JSON) .extract() .path("$.items[0].kind"); } 

conclusion

 [TestNG] Running: /home/hp/.IdeaIC2017.1/system/temp-testng-customsuite.xml =============================================== Default Suite Total tests run: 1, Failures: 0, Skips: 0 =============================================== 

Process finished with exit code 0 enter image description here

  • I give a hint, the value must not only be extracted, but also stored in a variable. And the variable can be output by anyone who has seen Hello World . - Sergey Gornostaev

1 answer 1

 String itemKind = given() .param("q", "9789652868374") .contentType(ContentType.JSON) .get("https://www.googleapis.com/books/v1/volumes") .then() .extract() .path("items[0].kind"); System.out.println("Kind: " + itemKind);