
Overview on the karate framework we are going to study as part of this lecture.
Karate configuration we are going to study
Configure a Maven-based Karate project by importing dependencies, creating a feature file and runner, and validating with Karate JUnit, using Eclipse or VS Code on Java 17, 21, or 24.
Maven is a build automation tool that manages dependencies and artifacts via pom.xml. This overview shows creating a maven project in eclipse and managing dependencies from the maven central repository.
Overview on API testing
GET Example using Karate
Scenario: Verify current whether data
Given url 'api.openweathermap.org/data/2.5/weather?q=London&appid=3c322ae59a7b42'
When method get
Then status 200
Feature: validate variables concept
Background:
Given def company_name = "Lebyy.com"
Scenario: verify varaible data type
Given def employee_name = "surendra"
When def employee_id = 456
Then print employee_id
Then print employee_name
Then print "Employee ID value is", employee_id
Then print "Employee name is" ,employee_name
Then print "Company name is", company_name
Scenario: reuse of variable
Then print "Employee name is" ,employee_name
Then print "Company name is", company_name
Background:
Given url 'https://dummy.restapiexample.com'
Scenario: To get all employees information in JSON format
And path '/api/v1/employees'
And header Accept = 'application/json'
When method get
Then status 200
Scenario: To get specific employee details
And path '/api/v1/employee/1'
And header Accept = 'application/json'
When method get
Then status 200
Scenario: To get specific employee details
And path '/api/v1/employee/1'
And header Accept = 'application/json'
When method get
Then status 200
And print response.data.employee_salary
And print response.data.employee_name
And print response.data.id
And print response.data.employee_age
And print response.status
Execute and validate api tests with karate; inspect the generated execution report detailing pass/fail counts, status codes, timing, and scenario details, and learn how to refresh or customize reports.
Overview on JSON with examples
Assertions
Feature: Title of your feature
Background:
Given url 'https://dummy.restapiexample.com'
Scenario: To get all employees information in JSON format
And path '/api/v1/employees'
And header Accept = 'application/json'
When method get
Then status 200
And match header Content-Type == 'application/json'
And match response contains deep {"data":[{"id":1}]}
And match response contains deep {"data":[{"employee_name":"Caesar Vance"}]}
And match response.data == "#[24]"
#And match each response.data[*].employee_name contains "surendra"
And match response.data[*].employee_name == ["Garrett Winters","Tiger Nixon","Ashton Cox","Cedric Kelly","Airi Satou","Brielle Williamson","Herrod Chandler","Rhona Davidson","Colleen Hurst","Sonya Frost","Jena Gaines","Quinn Flynn","Charde Marshall","Haley Kennedy","Tatyana Fitzpatrick","Michael Silva","Paul Byrd","Gloria Little","Bradley Greer","Dai Rios","Jenette Caldwell","Yuri Berry","Caesar Vance","Doris Wilder"]
#Scenario: To get specific employee details
#And path '/api/v1/employee/1'
#And header Accept = 'application/json'
#When method get
#Then status 200
#And match response.data.employee_salary == 320800
#And match response.data.employee_name == "Surendra Jaganadam"
Examples on Scenario Outline , Def, print
Karate Tutorial POST example
Fetch the employee list via a get request and validate the full response structure with karate's match each, ensuring optional profile image, mandatory employee name, and numeric salary and age.
Karate Runner configuration , Karate Options
Calling other feature
Karate Assertions with examples Part 2
Karate Schema validations Part 1
Karate Schema validations Part 2
Feature: Validate embedded expressions
Scenario: To POST an entry using expressions
Given url 'https://reqres.in/api/users'
And header Accept = 'application/json'
Then def empName = "surendra jaganadam"
Then request { "name": '#(empName)',"job": "mobile automation tester" }
When method post
Then status 201
Scenario: To get all employees information in JSON format
Given url 'https://thetestrequest.com/authors/1.xml'
And header Accept = 'application/xml'
Then def authorName = "Surendra Lebyy"
When method get
Then status 200
And match response.hash.name == '#(authorName)'
Feature: validations with examples
#Scenario: To get all employees information in JSON format
#And url 'https://jsonplaceholder.typicode.com/posts/1'
#When method get
#Then status 200
#And def schemaVal = {"userId": '#number', "id": '#number', "title": '#string', "body": '#string'}
#Then match response ==
#"""
#'#(schemaVal)'
#"""
Scenario: To get all employees information in JSON format
And url 'https://jsonplaceholder.typicode.com/posts/1/comments'
When method get
Then status 200
And def schemaVal = {"postId": '#number',"id": '#number', "name": '#string',"email": '#string',"body": '#string'}
Then match response ==
"""
'#[] #(schemaVal)'
"""
@wilson1
Scenario: Title of your scenario
Given url 'https://gorest.co.in/public/v2/users'
When method get
Then def outputData = []
#Then print response[0]
And eval for(var i=0; i<response.length; i++) if(response[i].name.endsWith("Butt")) outputData.push(response[i].email)
Then print outputData
Explore conditional statements and for loops in Karate framework to filter API responses by name, extract emails and other fields, and print results using def and eval.
Read data from a customized Java class and use it in a karate feature file by creating a Java reader, instantiating it in karate, and applying the returned values.
#Feature: Execute Java Script Function
#Scenario: validate js code 1
#Then def getValue = function() { return "surendra"; }
#Then print "function outpiut is ", getValue()
#Scenario: Function to add 2 numbers
#Then def sumValue = function(a,b) { return a+b; }
#Then def sumValue = function(a,b) { return a-b; }
#Then print "sum value os " , sumValue(100,150)
#Then print "sum value os " , sumValue(100,10)
#Scenario: Random Number
#Then def random = function() { return Math.random(); }
#Then print "random no is ", random()
Feature: Demo
Scenario: To get specific employee details
Given url 'https://dummy.restapiexample.com'
And path '/api/v1/employee/1'
And header Accept = 'application/json'
When method get
Then status 200
Given def expected_Response_Data = read("/ApplicationResponse.json")
#Then print expected_Response_Data
Then match response == expected_Response_Data
Scenario: To get all employees information in JSON format
Given url 'https://thetestrequest.com/authors.xml'
And header Accept = 'application/xml'
When method get
Then status 200
Given def expected_Response_Data = read("/ResponseData.xml")
#Then print expected_Response_Data
Then match response == expected_Response_Data
Scenario: To POST an entry
Given url 'https://reqres.in/api/users'
And header Accept = 'application/json'
Then def input_json_body = read("/inputData.json")
Then request input_json_body
When method post
Then status 201
Create a testing ground for API testing by signing up with email registration, configuring a Learn by yourself stream site, and launching a scrum project to access API token information.
.Overview on JIRA user API, capturing JIRA account id , generating access token & converting curl command into a postman
Feature: Validate File uploading flows
#Scenario: To POST an entry using expressions
#Given url 'https://chinnapavanm.atlassian.net/rest/api/3/issue/SCRUM-4/attachments'
#And header X-Atlassian-Token = 'no-check'
#Then header Authorization = call read('basic-auth.js') { username: 'chinnapavanm@gmail.com', password: 'ATATT3xFfGF0YQhLo-aH0Trjmg9kKyOBRMtVm-XXjuvVbTRJKBnElzEK-Piy15ISv0eUKbLyzh-tGdM9IxTCVgw8db0TmyANCbLviW6nPVH1jBUlvUXD-Taz_reudDCRwksq-EbwDWm-7d-Geab3DyW0_iY3xqFI_s6KUuzBQD3ZEHvYzZ7F08w=CE46325B' }
#Then multipart file file = { read: 'ApplicationResponse.json', filename: 'ApplicationResponse.json', Content-Type: 'multipart/form-data' }
#When method post
#Then status 200
Scenario: To POST an entry using expressions
Given url 'https://chinnapavanm.atlassian.net/rest/api/3/issue/SCRUM-4/attachments'
And header X-Atlassian-Token = 'no-check'
Then def fileLocation = '/data/README2.txt'
Then header Authorization = call read('basic-auth.js') { username: 'chinnapavanm@gmail.com', password: 'ATATT3xFfGF0YQhLo-aH0Trjmg9kKyOBRMtVm-XXjuvVbTRJKBnElzEK-Piy15ISv0eUKbLyzh-tGdM9IxTCVgw8db0TmyANCbLviW6nPVH1jBUlvUXD-Taz_reudDCRwksq-EbwDWm-7d-Geab3DyW0_iY3xqFI_s6KUuzBQD3ZEHvYzZ7F08w=CE46325B' }
Then multipart file file = { read: '#(fileLocation)', filename: 'README2.txt', Content-Type: 'multipart/form-data' }
When method post
Then status 200
Read test data from a CSV file and drive a POST API test by converting it to a scenario outline, then create multiple user entries and observe the results.
Refer below link which has examples what we discussed in the session:
https://github.com/json-path/JsonPath
reference link for the topics which we discussed in this lecture : https://github.com/karatelabs/karate#command-line
Scenario: To get all author information in xml format
Given url 'https://thetestrequest.com/authors.xml'
And header Accept = 'application/xml'
When method get
Then status 200
#And match response/objects/object[1]/email == 'viva@keebler.biz'
And match /objects/object[1]/email == 'viva@keebler.biz'
Scenario: To get author information in xml format
Given url 'https://thetestrequest.com/authors/1.xml'
And header Accept = 'application/xml'
When method get
Then status 200
And match response/hash/name == 'Karl Zboncak'
Identify and interact with browser UI elements using Karate locators and attributes to automate web tasks, covering id, name, hash selectors, and input actions across browsers.
Retrieve the current web page URL and title with Karate's driver.url and driver.title, and print them to the console. Verify the URL and title using matches.
Learn to handle dropdowns in Karate framework for UI automation, using select by index, value, full text, and partial text with locators and sample demonstrations.
Learn to retrieve text, get attributes and values, and switch between windows in Karate framework using text, attribute, and value commands, by title, index, or URL.
Learn to run only specific Karate API and UI automation scenarios by tagging them, passing Karate options in the runner class, and executing only those tagged scenarios.
Scenario: Verify images
#Given compareImage { baseline: 'Image 1.jpeg', latest: 'Image 1.jpeg' }
Given def latestImgBytes = karate.readAsBytes('Image 1.jpeg')
When compareImage { baseline: 'Image 1.jpeg', latest: '#(latestImgBytes)' }
Configure karate Gatling by creating a maven project, adding the Gatling and scala plugins, and wiring dependencies in pom.xml, using Visual Studio Code for performance testing.
Continue configuring gatling with karate by setting up a performance folder, moving a performance feature, updating pom.xml to gatling plugin 4.2.1, and organizing simulation, config, and data folders.
Create a Gatling runner extending simulation that wires Gatling to the karate protocol to run a demo performance feature with a 10-user, 5-second ramp.
Learn how karate protocol configuration consolidates multiple http get requests into a single gatling report. Assign a null id to the dynamic value so get-by-id requests aggregate into one output.
Learn how to simulate user think time in karate with the karate.pass method instead of thread.sleep to avoid blocking, and see a 10-second delay example across two scenarios.
Learn to access and print Gatling session attributes in karate, including user id, token, and role, using GitHub Copilot to build practical feature file examples and inspect session data.
Explore an open model injection in the karate framework for performance testing, ramping up users per second from five to ten over several seconds and analyzing per-second requests.
Guide to using the Karate framework to create a dashboard via a post request, define a json payload and endpoint, and validate responses with postman and curl.
Learn to delete a gadget from a dashboard using the API with curl and postman, by supplying the dashboard ID and gadget ID. Confirm a 204 response and verify removal.
Feature: Verifying end points as per the request
#Scenario: Verify country codes
#Given url 'https://restcountries.com/v3.1/alpha/GB'
#When method get
#Then status 200
#Then print response[0].capital[0]
#And match response[0].capital[0] == 'London'
Scenario Outline: Verify country codes
Given url 'https://restcountries.com/v3.1/alpha/<code>'
When method get
Then status 200
#Then print response[0].capital[0]
And match response[0].capital[0] == '<country>'
Examples:
|code|country|
|GB |London |
|FR |Paris |
|JP |Tokyo |
<dependency>
<groupId>com.intuit.karate</groupId>
<artifactId>karate-junit5</artifactId>
<version>1.4.1</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/com.intuit.karate/karate-core -->
<dependency>
<groupId>com.intuit.karate</groupId>
<artifactId>karate-core</artifactId>
<version>1.3.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.intuit.karate/karate-apache -->
<dependency>
<groupId>com.intuit.karate</groupId>
<artifactId>karate-apache</artifactId>
<version>0.9.6</version>
<scope>test</scope>
</dependency>
Learn how providing context improves LMS outputs by guiding language models with precise information, boosting accuracy, and producing focused, relevant results.
Define and control context for LLM-driven testing by setting role-based rules, avoiding hallucination, and generating manual or automation test cases from user stories, acceptance criteria, and UI mockups.
Explore AI models as data-trained algorithms, from GPT-style text generation to dalle-e image recognition, and see how LLMs are specialized tools within the broader AI toolbox.
Build an n8n workflow that reads data from Google Drive and Google Sheets via an AI agent, filters for Sam, and sends an email when matched.
Learn to create a Chrome extension for record and playback with cursor AI, generate Playwright TypeScript or Selenium scripts, and download test scripts for automated browser actions.
Generate karate API tests with Copilot in Eclipse by defining a clear context, producing karate feature files with given-when-then steps, and configuring proper headers and authentication.
Generate karate UI test cases in Eclipse Editor using Copilot, emphasizing accurate UI locators, given-when-then syntax, unique test names, and descriptive test descriptions across UI flows.
Generate a Karate UI test case using Cursor AI by analyzing the application, capturing locators, and creating a UI feature file for the login button on the home page.
Course is updated on 8-December-2025 with below concepts::
Overview on AI
Overview on LLM
Overview on RAG
Overview on Generative AI
Overview on Memory
Overview on AI Agent
Overview on LangChain & LangGraph
Overview on MCP Server
Overview on Human In the loop , Hallucination & Guardrails
Overview on Fine-Tuning
Overview on Context
Overview on Prompts
ChatGPT vs CoPilot vs CURSOR
Overview on OpenAI
Overview on AI Models
Overview on n8n workflow
Generate API Key in OpenAI
Create workflow in n8n
Create Public Chat in n8n workflow
Overview on OpenAI Tokens
CURSOR - Create a Chrome Extension for Record & Playback
CURSOR - Create an OTP Shield Mobile APP
Generate Karate API Test case using CoPilot in Eclipse Editor
Generate Karate API Test case using CoPilot in VSCode Editor
Generate Karate API Test case using Cursor Editor
Generate Karate UI Test case using CoPilot in Eclipse Editor
Generate Karate UI Test case using Cursor Editor
Course is updated on 24-August-2025 with below concepts::
Performance Testing using Gatling
Introduction to Karate-Gatling
Karate-Gatling configuration
Overview on Karate Protocol
Overview on Name Resolver
Pause For & Think time with examples
Karate feature - Tag Selector & Ignore Tags
Overview on Feeders - Reading data from csv & json
Overview on Open model injection with examples
Course updated on 27-March-2025:
Configure IntelliJ Editor for karate Framework
Course updated on 29-January-2025:
. Karate UI - How to compare images
Course updated on 21-November-2024:
How to handle Error: Could not find or load main class cucumber.api.cli.Main ???
Course updated on 06-August-2024:
XML Response Validations
Course updated on 30-July-2024:
Configuring Karate Framework with example -> Couple of students asked to update the content hence created this video
Course updated on 14-Feb-2024:
Compare Multiple Emails from Database
Course Updated on 02-07-2023 with below topics:
Karate UI Automation
ReRun a Failed Scenario
Upload a File, ScrollDown to an Object
Handling Multiple Windows, Get Text, Attribute & Value
Course Updated on 01-07-2023 with below topics:
Karate UI Automation
Handling Drop downs
Highlight, Focus, Submit, Clear commands with examples
Handling Alerts
Handling Frames
We are going to add few more videos to this content.
Course Updated on 30-06-2023 with below topics:
Karate framework HOOKS
Karate UI Automation -> we added 12 videos which covers various concepts on UI automation
Course Updated on 28-05-2023 with below topic:
How to Handle SSL Handshake error
Course Updated on 09-04-2023 with below topic:
How to resolve initialization error in karate framework after configuration
Course is updated on 07-05-2022 with below topics:
Jenkins Integration - Execute karate scripts from Jenkins CI/CD
Validate response using match each
overview on auth authentication
Course is updated on 06-05-2022 with below topics:
Execute karate scripts from the command line
Jenkins Integration - Execute karate scripts from Jenkins CI/CD
Course is updated on 05-05-2022 with below topics:
Reading data from karate config file and using it scenario
update runner class with environment specific variables
Integration of cucumber reporting
Parallel execution
Course is updated on 28-04-2022 with below topics:
overview on karate-config file
create karate-config file and add some data into it
use variables defined in config file inside the scenario
update runner class to recognise karate config file
Course is updated on 27-04-2022 with below topics:
Overview on reports generated by karate framework with example
JIRA POST with basic auth and accessing data from csv file
Course is updated on 26-04-2022 with below topics:
JIRA Trail account creation
Overview on JIRA user API, capturing JIRA account id , generating access token & converting curl command into a postman
Basic Auth on JIRA for retrieving user information using GET
Example on POST using JIRA Basic Auth
Course is updated on 24-04-2022 with below topics:
Examples on Scenario Outline- data to post request using scenario outline examples
Reading data from csv file and use it in post request
API Automation Made Simple using Karate framework
Karate Framework for beginners
API Automation with Karate Framework.
API Automation using Karate Framework
Karate Framework
Karate is an open-source general-purpose test-automation framework that can script calls to HTTP end-points and assert that the JSON or XML responses are as expected. Karate is implemented in Java but test-scripts are written in Gherkin since Karate was originally an extension of the Cucumber framework.
Karate is built on top of Cucumber, another BDD testing framework, and shares some of the same concepts. One of these is the use of a Gherkin file, which describes the tested feature. However, unlike Cucumber, tests aren't written in Java and are fully described in the Gherkin file.
From this course, you will learn the following concepts.
Karate configuration
Overview on API with examples
Overview on JSON with examples
Live example of API calls
Karate Framework
GET/POST Request
Data-Driven with Scenario Outline
Creating Parallel runner
Assertions
Using match
JSON Array matching
Schema validation
Fussy matcher: #string, #number
calling another feature
Tags and Run with tags
karate runner configuration and karate options
Report Generation
Cucumber Report Generation
Karate Report Generation
At the end of this training you will be in a position to work on your project using this framework. This course is designed for beginners who wants to start their career in api automation testing
See you in the session, thank you guys
#API Automation Testing
#APIAutomationTesting
#karate
#EndtoEndAPIAutomationwithKarateFramework.
#APIAutomationMadeSimple.
#End to End API Automation with Karate Framework.
#API Automation Made Simple.