Book Image

Writing API Tests with Karate

By : Benjamin Bischoff
Book Image

Writing API Tests with Karate

By: Benjamin Bischoff

Overview of this book

Software in recent years is moving away from centralized systems and monoliths to smaller, scalable components that communicate with each other through APIs. Testing these communication interfaces is becoming increasingly important to ensure the security, performance, and extensibility of the software. A powerful tool to achieve safe and robust applications is Karate, an easy-to-use, and powerful software testing framework. In this book, you’ll work with different modules of karate to get tailored solutions for modern test challenges. You’ll be exploring interface testing, UI testing as well as performance testing. By the end of this book, you’ll be able to use the Karate framework in your software development lifecycle to make your APIs and applications robust and trustworthy.
Table of Contents (15 chapters)
1
Part 1:Karate Basics
7
Part 2:Advanced Karate Functionalities

Configuring log options

When working on new tests or debugging existing ones, the logs are usually a good indicator of what is going on while a test is being run and what happens if it fails. While we see them on the command line when running a test there, they are also usually stored within the Maven project’s target directory – the standard directory that is created when running the test project via Maven:

Figure 5.1 – karate.log within the target directory

Figure 5.1 – karate.log within the target directory

Now, let’s look at log levels and what they mean!

Understanding log levels

Log levels determine which kinds of logs you want to include in the output. Karate uses the logging library Logback, which supports multiple log levels: TRACE, DEBUG, INFO, WARN, and ERROR. These get less verbose from left to right and determine the scope and purpose of each log entry. The most common one is INFO, which indicates a log output that prints out the basic actions and values that...