SlideShare a Scribd company logo
API testing with Open Source
Code libraries and Cucumber
Ole Lensmar – SmartBear
22
Short about “Shift-Left”
• Enterprise testing and QA is moving from late to
early phases in the development life-cycle
– QA -> Dev -> Design
• Tests are being expressed as code instead of using
visual tools (by both QA and Dev)
– Re-use of existing Test assets / scripts for different types of
tests
• Code-driven approach not just for functional testing
– Load/performance testing
– Security testing
– Mocking / Virtualization
33
Testing at API layer vs Unit tests
• API-layer testing = integration testing of
implementing classes/components
• Unit-testing frameworks often used to
”orchestrate”
– Junit / TestNG / Failsafe etc.
• Tests are managed together with implementing
code - using traditional SCM tools
• Tests are executed as part of existing builds
– Test running instance of API vs implementation
44
Code driven approach to API Testing
• HTTP clients
– Apache HTTPClient, OkHttp, Super-agent, etc.
• Generated clients
– Swagger Codegen, WSDL2Java, etc.
• Special purpose libraries
– REST-Assured (Java/Groovy)
– Chakram, (JS)
– ReadyApi4j (Java)
• Cucumber / BDD - many platforms/languages
55
Approach for comparison
• Simple scenario with single and chained REST
requests testing the SwaggerHub integration API
• Framework specific highlights
• All available on GitHub:
https://github.com/olensmar/apidays-apitesting
• All run with maven (“mvn test”) except javascript
sample
66
Apache HTTP-Client
• Widely used java client library for HTTP
• Exposes fluent API for building / executing
requests and reading responses
• Lacks built in support for JSON / XML parsing or
assertions
– Need to do this manually using Jackson/DOM/etc.
77
Generated clients
• Use code-generation tools to generate client from
API description
• Write tests using generated client
– Automate client generation as part of build
• Pros
– API changes can break tests
– Isolates from network layer – tests at functional level
• Cons
– Relies on correctness of client-generator
– Isolates from network layer – tests at functional level
88
REST-Assured
• Fluent Java API for testing REST APIs
• Support both JSON and XML content assertions
– Uses standalone JSONPath and Xpath implementations
• Built in support for multiple authentication types, XSRF,
etc.
• Very customizable at the network/http/marshalling layers
• http://rest-assured.io/
99
ReadyAPI4j
• Fluent Java API
– Leverages the SoapUI Testing engine
– REST, SOAP, Assertions, orchestration, etc.
• Internally compiles tests into “Test Recipes”
(json)
– Can be reused for performance/security testing in
SoapUI
• Execution either locally or remotely
– Local execution for ease of use (open source)
– Remote execution for access control, performance,
reporting, etc. (commercial)
1010
Maven/Java project
ReadyApi4j execution model
API Test
/src/test/java
ReadyApi4j API
Local Engine ReadyAPI
Testserver
API(s) under test
use
use
call
API calls
1111
Challenges with code-driven API testing
• Running against different environments
– Temporary environments (Docker can help)
– Actual environments
• Testing either with or without network
– Network is more realistic – more work to automate
• External dependencies may need to be mocked
– 3rd party APIs, databases, etc.
– For both functional and non-functional testing
• Simulate errors, response times, invalid responses, etc.
Cucumber for API testing
1313
Cucumber – “Executable Specifications”
• Heavily associated with Behavior Driven Development
• “Plain language” verbalization of requirements
– POs, Business Analysts, Developers, Testers, etc.
• For example
Given a user has logged in with valid credentials
When a deposit of 100 USD is made
Then the account balance increases by 100 USD
And the user gets a confirmation message
1414
Scenarios/Features written in “Gherkin”
• Given X
• When Y
• Then Z
• More keywords: And, Feature, Scenario,
Background, etc.
• Packaged into “feature files”
• Cucumber reads feature files and executes
corresponding “StepDefs” or “GlueCode”
1515
Automated Build / Test executions
Cucumber “execution pipeline”
Cucumber
Runner
StepDefs
Component /
System under test
1. Parse
2. Invoke
.feature files
Ant/Maven/Gra
dle/CLI/etc [@tag]
1616
Cucumber StepDefs
• Code that is executed by the cucumber
framework for each statement
• Must be implemented manually to support the
desired vocabulary
• Cucumber Java example -> code!
1717
Cucumber “styles”
• Declarative style
– Domain-specific vocabulary for describing the business
requirements
– Appeals to non-technical users
– High overhead in creation and maintenance
• Imperative style
– Generic vocabulary for describing requirements
– Appeals more to technical users
– Lower maintenance – but “Misses the point”
• Either requires implementation of StepDefs
1818
Declarative API Testing Example
Feature: SwaggerHub REST API
Scenario: Default API Listing
When a request to the API listing is made
Then a list of APIs should be returned within 500ms
Scenario: TestServer API Retrieval
Given an owner named smartbear
And an api named ready-api-testserver
And a version named 1.0.0
When a request to the API listing is made
Then an API definition should be returned within 500ms
1919
Imperative API Testing Example
Feature: Petstore API
Scenario: Find pet by status
Given the API running at http://petstore.swagger.io/v2
When a GET request to /pet/findByStatus is made
And the status parameter is test
And the Accepts header is application/json
Then a 200 response is returned within 50ms
2020
Imperative API Testing Example with Swagger
Feature: Petstore API
operationId gives
path and method
operation parameter
type not neededa defined response
2121
Managing Feature files and StepDefs
• Keep feature files together with source code
and/or in separate repository
• Use tagging feature of Cucumber to selectively
(re)run tests
• Use datasets for parameterization
– Inline or external
• Bundle StepDefs in separate library
– Automate execution
2222
ReadyApi4j - Cucumber for APIs
• Out-of-the box generic vocabulary for REST API Testing -
integrated Swagger support
• Extensible – built on Cucumber for Java
– Open-source on GitHub
– https://github.com/readyapi/testserver-cucumber
• Packaged as library or Docker image
– https://hub.docker.com/r/smartbear/cucumber4apis
• Uses ReadyApi4j as execution engine (either local or
remote)
2323
That’s it! – Questions?
• @olensmar
• https://github.com/olensmar/apidays-apitesting
• https://hc.apache.org
• http://rest-assured.io/
• http://dareid.github.io/chakram/
• http://frisbyjs.com/
• https://github.com/SmartBear/readyapi4j
• https://cucumber.io/
• https://github.com/readyapi/testserver-cucumber
• https://hub.docker.com/r/smartbear/cucumber4apis

More Related Content

What's hot (20)

PPTX
Test your microservices with REST-Assured
Michel Schudel
 
PPTX
Micro-Frontend Architecture
Livares Technologies Pvt Ltd
 
PPTX
QA Best Practices in Agile World_new
Praveen Dosapati (CSM)
 
PDF
Test and Behaviour Driven Development (TDD/BDD)
Lars Thorup
 
PPTX
Cucumber BDD
Pravin Dsilva
 
PPTX
Cucumber presenation
Oussama BEN WAFI
 
PPTX
Test Automation Framework with BDD and Cucumber
Rhoynar Software Consulting
 
PPT
Testing in Agile Projects
sriks7
 
PPTX
Testing microservices with rest assured
Kushan Shalindra Amarasiri - Technical QE Specialist
 
PPTX
API Testing Using REST Assured with TestNG
Siddharth Sharma
 
ODP
BDD with Cucumber
Knoldus Inc.
 
PPT
Agile QA and Testing process
Gloria Stoilova
 
PPTX
Cypress Automation
Susantha Pathirana
 
PPT
Basic Guide to Manual Testing
Hiral Gosani
 
PDF
Introduction to TDD and BDD
Luis García Castro
 
PPSX
API Test Automation
SQALab
 
PPTX
RESTful API Testing using Postman, Newman, and Jenkins
QASymphony
 
PDF
API Testing
Bikash Sharma
 
PPTX
BDD presentation
temebele
 
Test your microservices with REST-Assured
Michel Schudel
 
Micro-Frontend Architecture
Livares Technologies Pvt Ltd
 
QA Best Practices in Agile World_new
Praveen Dosapati (CSM)
 
Test and Behaviour Driven Development (TDD/BDD)
Lars Thorup
 
Cucumber BDD
Pravin Dsilva
 
Cucumber presenation
Oussama BEN WAFI
 
Test Automation Framework with BDD and Cucumber
Rhoynar Software Consulting
 
Testing in Agile Projects
sriks7
 
Testing microservices with rest assured
Kushan Shalindra Amarasiri - Technical QE Specialist
 
API Testing Using REST Assured with TestNG
Siddharth Sharma
 
BDD with Cucumber
Knoldus Inc.
 
Agile QA and Testing process
Gloria Stoilova
 
Cypress Automation
Susantha Pathirana
 
Basic Guide to Manual Testing
Hiral Gosani
 
Introduction to TDD and BDD
Luis García Castro
 
API Test Automation
SQALab
 
RESTful API Testing using Postman, Newman, and Jenkins
QASymphony
 
API Testing
Bikash Sharma
 
BDD presentation
temebele
 

Similar to API Testing with Open Source Code and Cucumber (20)

PDF
Aws Technical Day 2015 - Amazon API Gateway
aws-marketing-il
 
PDF
InterConnect 2016 Java EE 7 Overview (PEJ-5296)
Kevin Sutter
 
PPTX
Structured Functional Automated Web Service Testing
rdekleijn
 
PPTX
A basic introduction to API Testing & its importance.
Prashantsingh911569
 
PPTX
API testing - Japura.pptx
TharindaLiyanage1
 
PPTX
Jakarta EE Test Strategies (2022)
Ryan Cuprak
 
PDF
REST APIs
Arthur De Magalhaes
 
PPTX
Testing Testing everywhere
Antonio Robres Turon
 
PDF
API Check Overview - Rigor Monitoring
Anthony Ferrari
 
PPTX
Introduction to cypress in Angular (Chinese)
Hong Tat Yew
 
PPTX
AWS Summit Barcelona 2015 - Introducing Amazon API Gateway
Vadim Zendejas
 
PPTX
API City 2019 Presentation - Delivering Developer Tools at Scale: Microsoft A...
Joe Levy
 
PDF
Kafka for Microservices – You absolutely need Avro Schemas! | Gerardo Gutierr...
HostedbyConfluent
 
PPTX
SOA Testing
Roopesh Kohad
 
PPT
Brightcove presentation on Automated Testing
MassTLC
 
PPTX
One to rule them all
Antonio Robres Turon
 
PPTX
Helpful Automation Techniques - Selenium Camp 2014
Justin Ison
 
PDF
Api security-testing
n|u - The Open Security Community
 
PPTX
What I Learned From Writing a Test Framework (And Why I May Never Write One A...
Daryl Walleck
 
PDF
Designing your API Server for mobile apps
Mugunth Kumar
 
Aws Technical Day 2015 - Amazon API Gateway
aws-marketing-il
 
InterConnect 2016 Java EE 7 Overview (PEJ-5296)
Kevin Sutter
 
Structured Functional Automated Web Service Testing
rdekleijn
 
A basic introduction to API Testing & its importance.
Prashantsingh911569
 
API testing - Japura.pptx
TharindaLiyanage1
 
Jakarta EE Test Strategies (2022)
Ryan Cuprak
 
Testing Testing everywhere
Antonio Robres Turon
 
API Check Overview - Rigor Monitoring
Anthony Ferrari
 
Introduction to cypress in Angular (Chinese)
Hong Tat Yew
 
AWS Summit Barcelona 2015 - Introducing Amazon API Gateway
Vadim Zendejas
 
API City 2019 Presentation - Delivering Developer Tools at Scale: Microsoft A...
Joe Levy
 
Kafka for Microservices – You absolutely need Avro Schemas! | Gerardo Gutierr...
HostedbyConfluent
 
SOA Testing
Roopesh Kohad
 
Brightcove presentation on Automated Testing
MassTLC
 
One to rule them all
Antonio Robres Turon
 
Helpful Automation Techniques - Selenium Camp 2014
Justin Ison
 
Api security-testing
n|u - The Open Security Community
 
What I Learned From Writing a Test Framework (And Why I May Never Write One A...
Daryl Walleck
 
Designing your API Server for mobile apps
Mugunth Kumar
 
Ad

More from SmartBear (20)

PPTX
Enforcing Your Organization's API Design Standards with SwaggerHub
SmartBear
 
PPTX
Introducing OpenAPI Version 3.1
SmartBear
 
PPTX
IATA Open Air: How API Standardization Enables Innovation in the Airline Indu...
SmartBear
 
PPTX
The State of API 2020 Webinar – Exploring Trends, Tools & Takeaways to Drive ...
SmartBear
 
PPTX
How LISI Automotive Accelerated Application Delivery with SwaggerHub
SmartBear
 
PPTX
Standardising APIs: Powering the Platform Economy in Financial Services
SmartBear
 
PPTX
Getting Started with API Standardization in SwaggerHub
SmartBear
 
PPTX
Adopting a Design-First Approach to API Development with SwaggerHub
SmartBear
 
PPTX
Standardizing APIs Across Your Organization with Swagger and OAS | A SmartBea...
SmartBear
 
PPTX
Effective API Lifecycle Management
SmartBear
 
PDF
The API Lifecycle Series: Exploring Design-First and Code-First Approaches to...
SmartBear
 
PDF
The API Lifecycle Series: Evolving API Development and Testing from Open Sour...
SmartBear
 
PPTX
Artificial intelligence for faster and smarter software testing - Galway Mee...
SmartBear
 
PDF
Successfully Implementing BDD in an Agile World
SmartBear
 
PPTX
The Best Kept Secrets of Code Review | SmartBear Webinar
SmartBear
 
PPTX
How Capital One Scaled API Design to Deliver New Products Faster
SmartBear
 
PPTX
Testing Without a GUI Using TestComplete
SmartBear
 
PPTX
Hidden Treasure - TestComplete Script Extensions
SmartBear
 
PDF
How Bdd Can Save Agile
SmartBear
 
PPTX
API Automation and TDD to Implement Master Data Survivorship Rules
SmartBear
 
Enforcing Your Organization's API Design Standards with SwaggerHub
SmartBear
 
Introducing OpenAPI Version 3.1
SmartBear
 
IATA Open Air: How API Standardization Enables Innovation in the Airline Indu...
SmartBear
 
The State of API 2020 Webinar – Exploring Trends, Tools & Takeaways to Drive ...
SmartBear
 
How LISI Automotive Accelerated Application Delivery with SwaggerHub
SmartBear
 
Standardising APIs: Powering the Platform Economy in Financial Services
SmartBear
 
Getting Started with API Standardization in SwaggerHub
SmartBear
 
Adopting a Design-First Approach to API Development with SwaggerHub
SmartBear
 
Standardizing APIs Across Your Organization with Swagger and OAS | A SmartBea...
SmartBear
 
Effective API Lifecycle Management
SmartBear
 
The API Lifecycle Series: Exploring Design-First and Code-First Approaches to...
SmartBear
 
The API Lifecycle Series: Evolving API Development and Testing from Open Sour...
SmartBear
 
Artificial intelligence for faster and smarter software testing - Galway Mee...
SmartBear
 
Successfully Implementing BDD in an Agile World
SmartBear
 
The Best Kept Secrets of Code Review | SmartBear Webinar
SmartBear
 
How Capital One Scaled API Design to Deliver New Products Faster
SmartBear
 
Testing Without a GUI Using TestComplete
SmartBear
 
Hidden Treasure - TestComplete Script Extensions
SmartBear
 
How Bdd Can Save Agile
SmartBear
 
API Automation and TDD to Implement Master Data Survivorship Rules
SmartBear
 
Ad

Recently uploaded (20)

PDF
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PDF
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
PDF
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
PDF
Staying Human in a Machine- Accelerated World
Catalin Jora
 
PPTX
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
PPTX
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
PDF
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
PDF
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
PDF
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
PDF
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PPTX
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PPTX
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
PDF
ICONIQ State of AI Report 2025 - The Builder's Playbook
Razin Mustafiz
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PPTX
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
DOCX
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
Staying Human in a Machine- Accelerated World
Catalin Jora
 
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
ICONIQ State of AI Report 2025 - The Builder's Playbook
Razin Mustafiz
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 

API Testing with Open Source Code and Cucumber

  • 1. API testing with Open Source Code libraries and Cucumber Ole Lensmar – SmartBear
  • 2. 22 Short about “Shift-Left” • Enterprise testing and QA is moving from late to early phases in the development life-cycle – QA -> Dev -> Design • Tests are being expressed as code instead of using visual tools (by both QA and Dev) – Re-use of existing Test assets / scripts for different types of tests • Code-driven approach not just for functional testing – Load/performance testing – Security testing – Mocking / Virtualization
  • 3. 33 Testing at API layer vs Unit tests • API-layer testing = integration testing of implementing classes/components • Unit-testing frameworks often used to ”orchestrate” – Junit / TestNG / Failsafe etc. • Tests are managed together with implementing code - using traditional SCM tools • Tests are executed as part of existing builds – Test running instance of API vs implementation
  • 4. 44 Code driven approach to API Testing • HTTP clients – Apache HTTPClient, OkHttp, Super-agent, etc. • Generated clients – Swagger Codegen, WSDL2Java, etc. • Special purpose libraries – REST-Assured (Java/Groovy) – Chakram, (JS) – ReadyApi4j (Java) • Cucumber / BDD - many platforms/languages
  • 5. 55 Approach for comparison • Simple scenario with single and chained REST requests testing the SwaggerHub integration API • Framework specific highlights • All available on GitHub: https://github.com/olensmar/apidays-apitesting • All run with maven (“mvn test”) except javascript sample
  • 6. 66 Apache HTTP-Client • Widely used java client library for HTTP • Exposes fluent API for building / executing requests and reading responses • Lacks built in support for JSON / XML parsing or assertions – Need to do this manually using Jackson/DOM/etc.
  • 7. 77 Generated clients • Use code-generation tools to generate client from API description • Write tests using generated client – Automate client generation as part of build • Pros – API changes can break tests – Isolates from network layer – tests at functional level • Cons – Relies on correctness of client-generator – Isolates from network layer – tests at functional level
  • 8. 88 REST-Assured • Fluent Java API for testing REST APIs • Support both JSON and XML content assertions – Uses standalone JSONPath and Xpath implementations • Built in support for multiple authentication types, XSRF, etc. • Very customizable at the network/http/marshalling layers • http://rest-assured.io/
  • 9. 99 ReadyAPI4j • Fluent Java API – Leverages the SoapUI Testing engine – REST, SOAP, Assertions, orchestration, etc. • Internally compiles tests into “Test Recipes” (json) – Can be reused for performance/security testing in SoapUI • Execution either locally or remotely – Local execution for ease of use (open source) – Remote execution for access control, performance, reporting, etc. (commercial)
  • 10. 1010 Maven/Java project ReadyApi4j execution model API Test /src/test/java ReadyApi4j API Local Engine ReadyAPI Testserver API(s) under test use use call API calls
  • 11. 1111 Challenges with code-driven API testing • Running against different environments – Temporary environments (Docker can help) – Actual environments • Testing either with or without network – Network is more realistic – more work to automate • External dependencies may need to be mocked – 3rd party APIs, databases, etc. – For both functional and non-functional testing • Simulate errors, response times, invalid responses, etc.
  • 12. Cucumber for API testing
  • 13. 1313 Cucumber – “Executable Specifications” • Heavily associated with Behavior Driven Development • “Plain language” verbalization of requirements – POs, Business Analysts, Developers, Testers, etc. • For example Given a user has logged in with valid credentials When a deposit of 100 USD is made Then the account balance increases by 100 USD And the user gets a confirmation message
  • 14. 1414 Scenarios/Features written in “Gherkin” • Given X • When Y • Then Z • More keywords: And, Feature, Scenario, Background, etc. • Packaged into “feature files” • Cucumber reads feature files and executes corresponding “StepDefs” or “GlueCode”
  • 15. 1515 Automated Build / Test executions Cucumber “execution pipeline” Cucumber Runner StepDefs Component / System under test 1. Parse 2. Invoke .feature files Ant/Maven/Gra dle/CLI/etc [@tag]
  • 16. 1616 Cucumber StepDefs • Code that is executed by the cucumber framework for each statement • Must be implemented manually to support the desired vocabulary • Cucumber Java example -> code!
  • 17. 1717 Cucumber “styles” • Declarative style – Domain-specific vocabulary for describing the business requirements – Appeals to non-technical users – High overhead in creation and maintenance • Imperative style – Generic vocabulary for describing requirements – Appeals more to technical users – Lower maintenance – but “Misses the point” • Either requires implementation of StepDefs
  • 18. 1818 Declarative API Testing Example Feature: SwaggerHub REST API Scenario: Default API Listing When a request to the API listing is made Then a list of APIs should be returned within 500ms Scenario: TestServer API Retrieval Given an owner named smartbear And an api named ready-api-testserver And a version named 1.0.0 When a request to the API listing is made Then an API definition should be returned within 500ms
  • 19. 1919 Imperative API Testing Example Feature: Petstore API Scenario: Find pet by status Given the API running at http://petstore.swagger.io/v2 When a GET request to /pet/findByStatus is made And the status parameter is test And the Accepts header is application/json Then a 200 response is returned within 50ms
  • 20. 2020 Imperative API Testing Example with Swagger Feature: Petstore API operationId gives path and method operation parameter type not neededa defined response
  • 21. 2121 Managing Feature files and StepDefs • Keep feature files together with source code and/or in separate repository • Use tagging feature of Cucumber to selectively (re)run tests • Use datasets for parameterization – Inline or external • Bundle StepDefs in separate library – Automate execution
  • 22. 2222 ReadyApi4j - Cucumber for APIs • Out-of-the box generic vocabulary for REST API Testing - integrated Swagger support • Extensible – built on Cucumber for Java – Open-source on GitHub – https://github.com/readyapi/testserver-cucumber • Packaged as library or Docker image – https://hub.docker.com/r/smartbear/cucumber4apis • Uses ReadyApi4j as execution engine (either local or remote)
  • 23. 2323 That’s it! – Questions? • @olensmar • https://github.com/olensmar/apidays-apitesting • https://hc.apache.org • http://rest-assured.io/ • http://dareid.github.io/chakram/ • http://frisbyjs.com/ • https://github.com/SmartBear/readyapi4j • https://cucumber.io/ • https://github.com/readyapi/testserver-cucumber • https://hub.docker.com/r/smartbear/cucumber4apis