Karate Dsl Api Automation And Performance From Zero To Hero

API Automation Testing, Performance and Load Testing with Karate DSL and Gatling framework. API testing made simple.

Last updated 2022-01-10 | 4.6

- How to automate API testing
- Performance and Load testing with Gatling
- JSON Manipulations

What you'll learn

How to automate API testing
Performance and Load testing with Gatling
JSON Manipulations
Test-Data Generation
Creating Strong Assertions
User-Flow Simulation using APIs

* Requirements

* Windows or Mac computer
* Basic understanding of programming (any language)
* Basic experience with Java or JavaScript would be a plus

Description

Karate DSL - a framework for API automation testing, Performance, and Load testing. This framework is running on Java and using Apache HTTP client to perform Http connections. For the performance testing, Karate DSL has a very nice integration with the Gatling framework.

Karate has its own scripting language (DSL - Domain Specific Language), which is pretty simple and can be picked up by people who don't have coding experience. It looks like the Cucumber framework, but it only looks like that. The framework has a predefined set of scripting commands for any operation you might need during interaction with APIs. Also, the framework has native support of JAVA and JavaScript programming languages, so you can create any custom methods and use it in Karate if you need it.

The key advantages of the framework:

  • Own easy scripting language. You don't need to have coding skills to start writing tests

  • Native JavaScript support and JSON objects (forget about parsers)

  • Very powerful assertions and JSON schema validation

  • Parallel execution (it's very fast)

  • Integration with Gatling for Performance testing

What you will learn:

  • Basics: what is API and JSON objects. You ll have a clear understanding of the concept of how API works and how to work with JSON objects

  • How to set up and configure Karate framework from scratch

  • How to perform GET, POST, PUT, DELETE requests

  • How to make powerful assertions for API responses, traverse through JSON objects, fuzzy matching assertions, and JSON schema validation

  • How to chain API calls, re-use API response to form new API request

  • How to generate random test data, use this test data in API requests

  • How to handle authorization headers, access tokens

  • Before/After hooks, parallel test execution, conditional testing, data-driven testing

  • How to use Karate scripts for Performance and Load Testing with Gatling framework

Karate DSL is a really great framework for API Automation and my Number 1 choice.

Who this course is for:

  • Quality Engineers
  • QA Automation Engineers
  • Developers who need quickly automate API regression testing

Course content

7 sections • 46 lectures

Introduction Preview 02:01

Introduction to the course

Karate VS Rest Assured Preview 06:35

Comparison of the main Pros and Cons for Karate DSL framework VS REST Assured framework

What is JSON Preview 10:01

Explanation of what is JSON and how to read, add and update data in JSON objects using JSON path

What is API Preview 10:27

What is API. Type of REST requests. Definition of status codes. Basic concept of why do we need to make API automation and how Karate plays its role in it.

Environment Setup Preview 09:17

Preparation of development environment. Installation of all needed dependencies to our system to be able to work with this class

Clone Test Project Preview 04:53

Cloning and installation of the Test Project for this class. Alternatively, you can use the "Deployed project" which is already up and running. Check the URL attached to this lesson.

Alternative Test Project Preview 04:05

Karate Framework Setup Preview 03:03

How to set up a Karate project from scratch.

Karate Framework Overview Preview 09:20

Overview of Karate framework components and structure

First GET Request Preview 11:58

Writing the first simple test in Karate with GET request

Url and Path Preview 03:06

Difference between "Url" and "Path" commands in Karate when defining end-points

Simple Assertions Preview 10:28

First introduction to assertions in Karate

First POST Request Preview 12:49

Simple POST request in Karate. Rules and syntax.

Runner Configuration and Tags Preview 11:12

Definition of Karate Runner. Configuration of Tags to be able to run or ignore certain Features/Scenarios

DELETE Request Preview 09:03

Example of the DELETE request. Verification of successful deletion operation.

Calling Other Feature Preview 09:28

How to re-use the code by calling other Karate feature files.

Environment Variables Preview 12:53

Configuration of environment variables in karate-config.js and how to use these variables in feature files

Embedded and Multi-Line Expressions Preview 11:04

Explanation of embedded and multi-line expressions when working with JSON objects in feature files

Assertions Preview 14:03

How to make assertions of the response object. Working with JSON path. Exact match and partial match.

Fuzzy Matching Preview 06:41

How to make an assertion based on response value type or JSON object structure

Schema Validation Preview 10:10

How to make a validation of the response JSON schema

Test-Data Generator Preview 17:26

Creating of JAVA class and using a Faker library to generate random test data values. Then read this JAVA class in the feature files and use random test data in API requests

Data Driven Scenario Preview 14:13

How to re-use test scenario with a different set of test data and assert a result based on this data

Reading Other Files Preview 11:30

How to read other files (json, js, csv etc..) and use the result in test feature files

Mistakes and Debugging Preview 26:26

Review of typical errors and mistakes in Karate and how to debug your code if you face errors during test execution.

Homework Preview 08:26

Description of the homework by the end of API Automation section

Before and After Hooks Preview 09:36

Configuration of Before and After hooks in Karate. How to set up Before All test, Before Feature and Before Scenario logic. How to set up After Feature and After Scenario logic

Parallel Execution Preview 05:20

Configuration of Karate Runner to enable support of parallel test execution

Cucumber Reporter Preview 05:29

Importing alternative Cucumber HTML report to the framework

Conditional Logic Preview 14:12

How to implement conditional logic in feature files. IF -> ELSE logic.

Retry and Sleep Preview 07:36

How to make your test to retry a call if a condition is not satisfied. How to implement sleep (wait) in Karate.

JSON Transforms Preview 07:19

Different ways of JSON object transformation using Karate

Type Conversion Preview 05:44

How to convert String to Number and Number to String

Connect to SQL Database Preview 22:20

How to connect to SQL Database and perform INSERT query and SELECT query from the database

Karate in Docker Container Preview 11:29

How to run karate tests in Docker Container

Gatling Setup Preview 05:36

Installation of Gatling dependencies for Karate and configuration

First Simulation Preview 10:11

Setting up a simulation Scala class and running first smoke performance test

Karate Protocol Preview 03:38

Definition of Karate Protocol and configuration of reporting

User Think Time Preview 04:25

How correctly configure "User Think Time" in Karate. Simulation of user wait time between actions

Simulation Setup Preview 12:37

How to set up and configure the simulation flow, how to scale and inject virtual users over time to simulate load increasing to the application. How to read test results.

Feeder From File Preview 09:57

Inject test data from CSV file into virtual user session using Gatling feeder

Custom Feeder Preview 21:51

Creating a custom JAVA class to call the Create Token feature to generate access tokens and then use these tokens in the Gatling feeder. As a result, virtual users will have their own authorization tokens.

Name Resolver Preview 04:35

How to modify reporting using Name Resolver to provide better description to end points

Dispatcher Configuration Preview 05:23

Overriding of default values for akka dispatchers to resolve possible issues when new users are not injected into simulation

Where to Find More Information? Preview 04:06

Where to find more information and help?

Final Words Preview 00:40