SlideShare a Scribd company logo
KARATE DSL – API
AUTOMATION MADE EASY
Anil Borse
CURRENT STATE
 Teams still prefer to use Java for API tests.
 Manipulation and comparison of large and complex JSON is not easy
using Java.
 Dependent on Java Objects for building and validating data-payloads.
 Teams still struggle with parallel tests executions as its not provided
inbuilt.
 More lines of code, more maintenance.
 Non-programmers feels difficulty and hence, separate functional and
automation testing teams in organizations.
USING KARATE DSL
 Plain-text, super-readable and maintainable API test scripts.
 Inbuilt powerful and flexible JSON and XML assertions capability( deep-
equals).
 ‘smart compare’ of two JSONs or XMLs.
 No Java beans or helper code to represent payloads and responses.
 Non-programmers can easily contribute in scripting.
 Call reusable feature files and functions (Code reusability).
 Java-interop so we never "hit a wall" in the framework.
 Inbuilt multi-threaded parallel execution and report generation.
 Data-driven tests that can use JSON or CSV sources.
 Easy plugin with Cucumber-HTML reports.
 Reuse same functional API tests as performance tests.
 Comprehensive documentation and examples. Check
more at https://github.com/intuit/karate
GET REQUEST AND FULL JSON RESPONSE VALIDATION
Get Auth Token
Set API Host URL
Set Request Headers
GET Request
Validate Full JSON Response
POST REQUEST AND PARTIAL JSON RESPONSE VALIDATION
Create Single User Create Multiple Users
User Request Payload
POST Request
Validate
Response
for New
User
POST Request
Validate Response for New
User
Test Data
Read Json Request and Set
Request Payload
parameters from Examples
Test Data
KARATE-CONFIG
Base Config
Override Base Config for
Specific Environment
DB VALIDATION
Validate New User Data in DB
PUT REQUEST AND
VALIDATION
Call Create User Reusable
Feature
Update User
Request
Get Updated User
and Validate It
DELETE REQUEST AND VALIDATION
Call Create User Reusable
Feature
Delete User Request
Validate User is Deleted
BEST PRACTICES
 First create reusable features which performs GET, POST, PUT and DELETE actions and use
them wherever possible.
 Create DBUtils for data retrieval and manipulation like readRow, readRows, updateRows,
deleteRows etc.
 Data cleanup before/after every scenario/feature execution.
 Use CSV if parameterized Examples test data is large.
 Use Assert capabilities of Karate (match == , match contains, match contains deep etc.)
 Keep scenarios independent if possible.
 Try running scenarios in parallel from the beginning so that scenarios can be fixed to keep
independent.
 Differentiate scenario by tags (@smoke, @regression etc) and trigger them accordingly.
KEY TAKEAWAYS – KARATE DSL
 Teams can directly start API automation using Karate DSL without any base
framework.
 Irrespective of programming background, anyone in the product team can
contribute on API automation scripting.
 Team becomes more productive as API test scripts becomes more readable and
maintainable.
 Automation first approach can be taken as soon as project starts.
THANK YOU!

More Related Content

What's hot

Test Design and Automation for REST API
Test Design and Automation for REST APITest Design and Automation for REST API
Test Design and Automation for REST API
Ivan Katunou
 
Api Testing
Api TestingApi Testing
Api Testing
Vishwanath KC
 
Api testing
Api testingApi testing
Api testing
HamzaMajid13
 
Testing microservices with rest assured
Testing microservices with rest assuredTesting microservices with rest assured
Testing microservices with rest assured
Kushan Shalindra Amarasiri - Technical QE Specialist
 
How to Automate API Testing
How to Automate API TestingHow to Automate API Testing
How to Automate API Testing
Bruno Pedro
 
API Test Automation
API Test Automation API Test Automation
API Test Automation
SQALab
 
4 Major Advantages of API Testing
4 Major Advantages of API Testing4 Major Advantages of API Testing
4 Major Advantages of API Testing
QASource
 
API Testing
API TestingAPI Testing
API Testing
Bikash Sharma
 
Api testing
Api testingApi testing
Api testing
Keshav Kashyap
 
Types of performance testing
Types of performance testingTypes of performance testing
Types of performance testing
NaveenKumar Namachivayam
 
TestNG Session presented in Xebia XKE
TestNG Session presented in Xebia XKETestNG Session presented in Xebia XKE
TestNG Session presented in Xebia XKE
Abhishek Yadav
 
Setting up Page Object Model in Automation Framework
Setting up Page Object Model in Automation FrameworkSetting up Page Object Model in Automation Framework
Setting up Page Object Model in Automation Framework
valuebound
 
BDD for APIs
BDD for APIsBDD for APIs
BDD for APIs
Jason Harmon
 
Testing in-python-and-pytest-framework
Testing in-python-and-pytest-frameworkTesting in-python-and-pytest-framework
Testing in-python-and-pytest-framework
Arulalan T
 
Page Object Model and Implementation in Selenium
Page Object Model and Implementation in Selenium  Page Object Model and Implementation in Selenium
Page Object Model and Implementation in Selenium
Zoe Gilbert
 
Rest assured
Rest assuredRest assured
Rest assured
Varun Deshpande
 
API Testing. Streamline your testing process.
API Testing. Streamline your testing process.API Testing. Streamline your testing process.
API Testing. Streamline your testing process.
Andrey Oleynik
 
Hybrid automation framework
Hybrid automation frameworkHybrid automation framework
Hybrid automation framework
doai tran
 
API Testing Using REST Assured with TestNG
API Testing Using REST Assured with TestNGAPI Testing Using REST Assured with TestNG
API Testing Using REST Assured with TestNG
Siddharth Sharma
 
An Introduction To Automated API Testing
An Introduction To Automated API TestingAn Introduction To Automated API Testing
An Introduction To Automated API Testing
Sauce Labs
 

What's hot (20)

Test Design and Automation for REST API
Test Design and Automation for REST APITest Design and Automation for REST API
Test Design and Automation for REST API
 
Api Testing
Api TestingApi Testing
Api Testing
 
Api testing
Api testingApi testing
Api testing
 
Testing microservices with rest assured
Testing microservices with rest assuredTesting microservices with rest assured
Testing microservices with rest assured
 
How to Automate API Testing
How to Automate API TestingHow to Automate API Testing
How to Automate API Testing
 
API Test Automation
API Test Automation API Test Automation
API Test Automation
 
4 Major Advantages of API Testing
4 Major Advantages of API Testing4 Major Advantages of API Testing
4 Major Advantages of API Testing
 
API Testing
API TestingAPI Testing
API Testing
 
Api testing
Api testingApi testing
Api testing
 
Types of performance testing
Types of performance testingTypes of performance testing
Types of performance testing
 
TestNG Session presented in Xebia XKE
TestNG Session presented in Xebia XKETestNG Session presented in Xebia XKE
TestNG Session presented in Xebia XKE
 
Setting up Page Object Model in Automation Framework
Setting up Page Object Model in Automation FrameworkSetting up Page Object Model in Automation Framework
Setting up Page Object Model in Automation Framework
 
BDD for APIs
BDD for APIsBDD for APIs
BDD for APIs
 
Testing in-python-and-pytest-framework
Testing in-python-and-pytest-frameworkTesting in-python-and-pytest-framework
Testing in-python-and-pytest-framework
 
Page Object Model and Implementation in Selenium
Page Object Model and Implementation in Selenium  Page Object Model and Implementation in Selenium
Page Object Model and Implementation in Selenium
 
Rest assured
Rest assuredRest assured
Rest assured
 
API Testing. Streamline your testing process.
API Testing. Streamline your testing process.API Testing. Streamline your testing process.
API Testing. Streamline your testing process.
 
Hybrid automation framework
Hybrid automation frameworkHybrid automation framework
Hybrid automation framework
 
API Testing Using REST Assured with TestNG
API Testing Using REST Assured with TestNGAPI Testing Using REST Assured with TestNG
API Testing Using REST Assured with TestNG
 
An Introduction To Automated API Testing
An Introduction To Automated API TestingAn Introduction To Automated API Testing
An Introduction To Automated API Testing
 

Similar to Karate DSL

Nexthink Library - replacing a ruby on rails application with Scala and Spray
Nexthink Library - replacing a ruby on rails application with Scala and SprayNexthink Library - replacing a ruby on rails application with Scala and Spray
Nexthink Library - replacing a ruby on rails application with Scala and Spray
Matthew Farwell
 
Mule jdbc
Mule   jdbcMule   jdbc
Abstract #236765 advanced essbase java api tips and tricks
Abstract #236765 advanced essbase java api tips and tricksAbstract #236765 advanced essbase java api tips and tricks
Abstract #236765 advanced essbase java api tips and trickstimtow
 
Azure for SharePoint Developers - Workshop - Part 3: Web Services
Azure for SharePoint Developers - Workshop - Part 3: Web ServicesAzure for SharePoint Developers - Workshop - Part 3: Web Services
Azure for SharePoint Developers - Workshop - Part 3: Web Services
Bob German
 
Deep dive into the native multi model database ArangoDB
Deep dive into the native multi model database ArangoDBDeep dive into the native multi model database ArangoDB
Deep dive into the native multi model database ArangoDB
ArangoDB Database
 
Rollin onj Rubyv3
Rollin onj Rubyv3Rollin onj Rubyv3
Rollin onj Rubyv3
Oracle
 
Spring 3 - Der dritte Frühling
Spring 3 - Der dritte FrühlingSpring 3 - Der dritte Frühling
Spring 3 - Der dritte Frühling
Thorsten Kamann
 
Unit Testing and Coverage for AngularJS
Unit Testing and Coverage for AngularJSUnit Testing and Coverage for AngularJS
Unit Testing and Coverage for AngularJS
Knoldus Inc.
 
JAX-RS. Developing RESTful APIs with Java
JAX-RS. Developing RESTful APIs with JavaJAX-RS. Developing RESTful APIs with Java
JAX-RS. Developing RESTful APIs with Java
Jerry Kurian
 
Resthub lyonjug
Resthub lyonjugResthub lyonjug
Resthub lyonjug
Sébastien Deleuze
 
Bank_Automated_API_Testing
Bank_Automated_API_TestingBank_Automated_API_Testing
Bank_Automated_API_TestingAndy Saunders
 
Java server pages
Java server pagesJava server pages
Java server pages
Tanmoy Barman
 
Java New Evolution
Java New EvolutionJava New Evolution
Java New EvolutionAllan Huang
 
81 Rac
81 Rac81 Rac
Athena java dev guide
Athena java dev guideAthena java dev guide
Athena java dev guidedvdung
 
Java se 8 fundamentals
Java se 8 fundamentalsJava se 8 fundamentals
Java se 8 fundamentals
megharajk
 

Similar to Karate DSL (20)

Nexthink Library - replacing a ruby on rails application with Scala and Spray
Nexthink Library - replacing a ruby on rails application with Scala and SprayNexthink Library - replacing a ruby on rails application with Scala and Spray
Nexthink Library - replacing a ruby on rails application with Scala and Spray
 
Mule jdbc
Mule   jdbcMule   jdbc
Mule jdbc
 
Abstract #236765 advanced essbase java api tips and tricks
Abstract #236765 advanced essbase java api tips and tricksAbstract #236765 advanced essbase java api tips and tricks
Abstract #236765 advanced essbase java api tips and tricks
 
Azure for SharePoint Developers - Workshop - Part 3: Web Services
Azure for SharePoint Developers - Workshop - Part 3: Web ServicesAzure for SharePoint Developers - Workshop - Part 3: Web Services
Azure for SharePoint Developers - Workshop - Part 3: Web Services
 
Venkat Bandaru
Venkat BandaruVenkat Bandaru
Venkat Bandaru
 
Deep dive into the native multi model database ArangoDB
Deep dive into the native multi model database ArangoDBDeep dive into the native multi model database ArangoDB
Deep dive into the native multi model database ArangoDB
 
MyBatis
MyBatisMyBatis
MyBatis
 
Rollin onj Rubyv3
Rollin onj Rubyv3Rollin onj Rubyv3
Rollin onj Rubyv3
 
Spring 3 - Der dritte Frühling
Spring 3 - Der dritte FrühlingSpring 3 - Der dritte Frühling
Spring 3 - Der dritte Frühling
 
Unit Testing and Coverage for AngularJS
Unit Testing and Coverage for AngularJSUnit Testing and Coverage for AngularJS
Unit Testing and Coverage for AngularJS
 
SandhyaRani
SandhyaRaniSandhyaRani
SandhyaRani
 
JAX-RS. Developing RESTful APIs with Java
JAX-RS. Developing RESTful APIs with JavaJAX-RS. Developing RESTful APIs with Java
JAX-RS. Developing RESTful APIs with Java
 
Resthub lyonjug
Resthub lyonjugResthub lyonjug
Resthub lyonjug
 
Bank_Automated_API_Testing
Bank_Automated_API_TestingBank_Automated_API_Testing
Bank_Automated_API_Testing
 
Java server pages
Java server pagesJava server pages
Java server pages
 
Java New Evolution
Java New EvolutionJava New Evolution
Java New Evolution
 
81 Rac
81 Rac81 Rac
81 Rac
 
81 Pdfsam
81 Pdfsam81 Pdfsam
81 Pdfsam
 
Athena java dev guide
Athena java dev guideAthena java dev guide
Athena java dev guide
 
Java se 8 fundamentals
Java se 8 fundamentalsJava se 8 fundamentals
Java se 8 fundamentals
 

Recently uploaded

Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Nexer Digital
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
sonjaschweigert1
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
Pierluigi Pugliese
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 

Recently uploaded (20)

Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 

Karate DSL

  • 1. KARATE DSL – API AUTOMATION MADE EASY Anil Borse
  • 2. CURRENT STATE  Teams still prefer to use Java for API tests.  Manipulation and comparison of large and complex JSON is not easy using Java.  Dependent on Java Objects for building and validating data-payloads.  Teams still struggle with parallel tests executions as its not provided inbuilt.  More lines of code, more maintenance.  Non-programmers feels difficulty and hence, separate functional and automation testing teams in organizations.
  • 3. USING KARATE DSL  Plain-text, super-readable and maintainable API test scripts.  Inbuilt powerful and flexible JSON and XML assertions capability( deep- equals).  ‘smart compare’ of two JSONs or XMLs.  No Java beans or helper code to represent payloads and responses.  Non-programmers can easily contribute in scripting.  Call reusable feature files and functions (Code reusability).  Java-interop so we never "hit a wall" in the framework.  Inbuilt multi-threaded parallel execution and report generation.  Data-driven tests that can use JSON or CSV sources.  Easy plugin with Cucumber-HTML reports.  Reuse same functional API tests as performance tests.  Comprehensive documentation and examples. Check more at https://github.com/intuit/karate
  • 4. GET REQUEST AND FULL JSON RESPONSE VALIDATION Get Auth Token Set API Host URL Set Request Headers GET Request Validate Full JSON Response
  • 5. POST REQUEST AND PARTIAL JSON RESPONSE VALIDATION Create Single User Create Multiple Users User Request Payload POST Request Validate Response for New User POST Request Validate Response for New User Test Data Read Json Request and Set Request Payload parameters from Examples Test Data
  • 6. KARATE-CONFIG Base Config Override Base Config for Specific Environment
  • 7. DB VALIDATION Validate New User Data in DB
  • 8. PUT REQUEST AND VALIDATION Call Create User Reusable Feature Update User Request Get Updated User and Validate It
  • 9. DELETE REQUEST AND VALIDATION Call Create User Reusable Feature Delete User Request Validate User is Deleted
  • 10. BEST PRACTICES  First create reusable features which performs GET, POST, PUT and DELETE actions and use them wherever possible.  Create DBUtils for data retrieval and manipulation like readRow, readRows, updateRows, deleteRows etc.  Data cleanup before/after every scenario/feature execution.  Use CSV if parameterized Examples test data is large.  Use Assert capabilities of Karate (match == , match contains, match contains deep etc.)  Keep scenarios independent if possible.  Try running scenarios in parallel from the beginning so that scenarios can be fixed to keep independent.  Differentiate scenario by tags (@smoke, @regression etc) and trigger them accordingly.
  • 11. KEY TAKEAWAYS – KARATE DSL  Teams can directly start API automation using Karate DSL without any base framework.  Irrespective of programming background, anyone in the product team can contribute on API automation scripting.  Team becomes more productive as API test scripts becomes more readable and maintainable.  Automation first approach can be taken as soon as project starts.