6

More Advanced Karate Features

In the previous chapters, we looked at how to write and run Karate tests and how to use the various reporting options to make sense of the results. In this chapter, we will explore some more advanced concepts and functionalities so that we can solve more elaborate test cases.

In this chapter, we will cover these main topics:

  • Working with headers and cookies
  • Using different configuration and run options
  • Defining and using expressions with def
  • Working with external files
  • Understanding JSONPath and XPath
  • Testing GraphQL

Technical requirements

The code examples for this chapter can be found at https://github.com/PacktPublishing/Writing-API-Tests-with-Karate/tree/main/chapter06.

You will require the following:

Get Writing API Tests with Karate now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.