
Comparison of the main Pros and Cons for Karate DSL framework VS REST Assured framework
Explanation of what is JSON and how to read, add and update data in JSON objects using JSON path
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.
Preparation of development environment. Installation of all needed dependencies to our system to be able to work with this class
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.
How to set up a Karate project from scratch.
Overview of Karate framework components and structure
Writing the first simple test in Karate with GET request
Difference between "Url" and "Path" commands in Karate when defining end-points
First introduction to assertions in Karate
Simple POST request in Karate. Rules and syntax.
Definition of Karate Runner. Configuration of Tags to be able to run or ignore certain Features/Scenarios
Example of the DELETE request. Verification of successful deletion operation.
How to re-use the code by calling other Karate feature files.
Configuration of environment variables in karate-config.js and how to use these variables in feature files
Explanation of embedded and multi-line expressions when working with JSON objects in feature files
How to make assertions of the response object. Working with JSON path. Exact match and partial match.
How to make an assertion based on response value type or JSON object structure
How to make a validation of the response JSON schema
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
How to re-use test scenario with a different set of test data and assert a result based on this data
How to read other files (json, js, csv etc..) and use the result in test feature files
Review of typical errors and mistakes in Karate and how to debug your code if you face errors during test execution.
Description of the homework by the end of API Automation section
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 configuration
Importing alternative Cucumber HTML report to the framework
How to implement conditional logic in feature files. IF -> ELSE logic.
How to make your test to retry a call if a condition is not satisfied. How to implement sleep (wait) in Karate.
Different ways of JSON object transformation using Karate
How to convert String to Number and Number to String
How to connect to SQL Database and perform INSERT query and SELECT query from the database
How to run karate tests in Docker Container
Installation of Gatling dependencies for Karate and configuration
Setting up a simulation Scala class and running first smoke performance test
Definition of Karate Protocol and configuration of reporting
How correctly configure "User Think Time" in Karate. Simulation of user wait time between actions
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.
Inject test data from CSV file into virtual user session using Gatling feeder
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.
How to modify reporting using Name Resolver to provide better description to end points
Overriding of default values for akka dispatchers to resolve possible issues when new users are not injected into simulation
Where to find more information and help?
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.