SlideShare a Scribd company logo
1 of 34
How to boost your automation skills with
a cup of energising Mocha
Lyudmila Anisimova
Olga Biletska
About me
Why do we value software quality?
If we can’t control the quality of
applications we can’t control the quality
of our lives
Have you heard about Centerlink fault?
Centrelink - government company that helps families and
people with low income
November 2016 - New automatic debt collection system was
introduced with 169 000 letters
Complaints rate - only 276 complaints from those 169,000
letters (Jan 9)
4 billions will be raised
What’s wrong?
What is API?
API - a set of functions and procedures that allow the creation of
applications which access the features or data of an operating system,
application, or other service.
Why do we need to start with API Automation?
● Manual testing takes far longer for automated solutions
● UI Automation is usually less stable
● Maintenance of UI tests takes a significant amount of time
● Test Early and Test Often - APIs usually are implemented first
Why automation is a quick win?
This is what we get after hard work is done
What are drawbacks of API implemented?
1. Automation can bring us false sense of security
2.Automation requires everyday support
3.Automation can delay releases
Olga Biletska
Test analyst at Digital Turbine
My first experience with automated API testing
Our project: Case 1 Testing APIs manually
---------->
Fears of manual tester
Frustration ----------> Hope Frisby!
How to start?
Learn this:
● How does http protocol work?
● What is API?
● What is JSON?
● Basic commands in Javascript
● How to install testing frameworks?
What Frisby does well:
•Send request/Adding headers to request
•Check types and values of responses
•Authorization via tokens and cookies
•Allows custom methods
Frisby – RESTful API testing framework
Structure of Frisby
test case
Example: testing API calls
to subscribe/unsubscribe
user
•Spec ending
•Test description
•Request/Response
•Defining expectations
•Toss Frisby
General workflow:
● Identify user
● Get access token
● Subscribe call
● Unsubscribe call
Structure of our test case: Part 1 – identify user and get access token
Define variables: var
Define new test: Frisby create()
Perform http GET request: get()
Check response code: expectStatus()
Structure of our test case: Part 2 – verify response data
Verify responses:
Check type of response:
expectJSONtypes
Check exact values:
afterJSON(function (body) {})
Matchers:
Expect.toEqual
Expect.toMatch
What we see in the console ------->
Structure of our test case: Part 3 – subscribe and unsubscribe user
Nested test
Define variables:
Var
Define new test:
Frisby.create()
Print results to console:
inspectJSON()
Fire the request:
toss()
Final part: running test case
Frisby installation
● Install Node.js: https://nodejs.org/en/download/ (NPM - Node Package
Manager will be installed automatically)
● Install Frisby locally: npm install frisby
● Install Jasmine node globally: npm install -g jasmine-node
Useful links
Frisby http://frisbyjs.com/docs/api/, https://github.com/verdverm/frisby,
http://testerzero.com/up-and-running-with-frisby-js-for-api-checks/
Jasmine: https://github.com/JamieMason/Jasmine-Matchers
Java Script: https://watchandcode.com/courses/enrolled/60264
Case 2
Device Caps - this system is responsible for mapping Game/Application
renditions to specified devices from Game Suppliers. It also contains the
logic to find known compatibility and extend coverage on this basis.
Search system module that works based on device caps functionality as the
user should be able to find only content that is supported.
Challenges
Over 2000 mobile devices
At least 5 main browsers
At least 15 different
Android OSes to test
Time limitation of 2 weeks
Boundary analysis gives unstable results
Now this is the time for a change
New automation framework
should support long delays
Installation
npm install mocha
npm install chai
npm install should
npm install joi
npm install mochawesome
Code structure
Declare variables
“ Describe “
Code structure
“ It “
.post/.get
.set
.send
.end .end
Verify your API
response status, type
and other data
Part II
Response verification with chai and should
res.should.have.status(200);
res.should.be.json;
res.body.should.be.a('array');
res.body.should.have.length(5);
res.body.should.be.a('object');
res.body.should.have.property('id');
res.body.id.should.be.a('number');
res.body.name.should.equal('3JHGFJHJHKJHK2211');
Traditional TDD interfaces in Mocha
suite - similar to describe
test - similar to it
setup - similar to before
teardown - similar to after
suiteSetup - similar to beforeEach
suiteTeardown - similar to afterEach
Example
2465 tests in 2 minutes
Links
https://mochajs.org/
http://shouldjs.github.io/#assertion-any
https://github.com/shouldjs/should.js
http://chaijs.com/
Connect with us
https://www.linkedin.com/in/lanissimova/
https://www.linkedin.com/in/olga-biletska-0aa4518a/

More Related Content

What's hot

What's hot (20)

API Testing: The heart of functional testing" with Bj Rollison
API Testing: The heart of functional testing" with Bj RollisonAPI Testing: The heart of functional testing" with Bj Rollison
API Testing: The heart of functional testing" with Bj Rollison
 
API TESTING
API TESTINGAPI TESTING
API TESTING
 
Api Testing
Api TestingApi Testing
Api Testing
 
API Testing for everyone.pptx
API Testing for everyone.pptxAPI Testing for everyone.pptx
API Testing for everyone.pptx
 
How to Automate API Testing
How to Automate API TestingHow to Automate API Testing
How to Automate API Testing
 
An introduction to api testing | David Tzemach
An introduction to api testing | David TzemachAn introduction to api testing | David Tzemach
An introduction to api testing | David Tzemach
 
An Introduction To Automated API Testing
An Introduction To Automated API TestingAn Introduction To Automated API Testing
An Introduction To Automated API Testing
 
RESTful API Testing using Postman, Newman, and Jenkins
RESTful API Testing using Postman, Newman, and JenkinsRESTful API Testing using Postman, Newman, and Jenkins
RESTful API Testing using Postman, Newman, and Jenkins
 
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
 
4 Major Advantages of API Testing
4 Major Advantages of API Testing4 Major Advantages of API Testing
4 Major Advantages of API Testing
 
Rest API Testing
Rest API TestingRest API Testing
Rest API Testing
 
Postman. From simple API test to end to end scenario
Postman. From simple API test to end to end scenarioPostman. From simple API test to end to end scenario
Postman. From simple API test to end to end scenario
 
POSTMAN.pptx
POSTMAN.pptxPOSTMAN.pptx
POSTMAN.pptx
 
POST/CON 2019 Workshop: Testing, Automated Testing, and Reporting APIs with P...
POST/CON 2019 Workshop: Testing, Automated Testing, and Reporting APIs with P...POST/CON 2019 Workshop: Testing, Automated Testing, and Reporting APIs with P...
POST/CON 2019 Workshop: Testing, Automated Testing, and Reporting APIs with P...
 
Reasons To Automate API Testing Process
Reasons To Automate API Testing ProcessReasons To Automate API Testing Process
Reasons To Automate API Testing Process
 
API Test Automation Tips and Tricks
API Test Automation Tips and TricksAPI Test Automation Tips and Tricks
API Test Automation Tips and Tricks
 
Api testing
Api testingApi testing
Api testing
 
Rest assured
Rest assuredRest assured
Rest assured
 
Postman.ppt
Postman.pptPostman.ppt
Postman.ppt
 
Postman
PostmanPostman
Postman
 

Viewers also liked

Automated Testing of NASA Software
Automated Testing of NASA SoftwareAutomated Testing of NASA Software
Automated Testing of NASA Software
Dharmalingam Ganesan
 

Viewers also liked (20)

Design patterns in test automation
Design patterns in test automationDesign patterns in test automation
Design patterns in test automation
 
5 top pain points of test automation
5 top pain points of test automation5 top pain points of test automation
5 top pain points of test automation
 
Automated Testing of NASA Software
Automated Testing of NASA SoftwareAutomated Testing of NASA Software
Automated Testing of NASA Software
 
Pre-Con Ed: Who Moved My UI? API Testing in a Headless World.
Pre-Con Ed: Who Moved My UI? API Testing in a Headless World.Pre-Con Ed: Who Moved My UI? API Testing in a Headless World.
Pre-Con Ed: Who Moved My UI? API Testing in a Headless World.
 
TestWorksConf: Exploratory Testing an API in Mob
TestWorksConf: Exploratory Testing an API in Mob TestWorksConf: Exploratory Testing an API in Mob
TestWorksConf: Exploratory Testing an API in Mob
 
Automated UI Testing
Automated UI TestingAutomated UI Testing
Automated UI Testing
 
Combining Heritrix and PhantomJS for Better Crawling of Pages with Javascript
Combining Heritrix and PhantomJS for Better Crawling of Pages with JavascriptCombining Heritrix and PhantomJS for Better Crawling of Pages with Javascript
Combining Heritrix and PhantomJS for Better Crawling of Pages with Javascript
 
SoapUI one key to all doors
SoapUI one key to all doorsSoapUI one key to all doors
SoapUI one key to all doors
 
Test trend analysis: Towards robust reliable and timely tests
Test trend analysis: Towards robust reliable and timely testsTest trend analysis: Towards robust reliable and timely tests
Test trend analysis: Towards robust reliable and timely tests
 
Testing NodeJS, REST APIs and MongoDB with UFT
Testing NodeJS, REST APIs and MongoDB with UFTTesting NodeJS, REST APIs and MongoDB with UFT
Testing NodeJS, REST APIs and MongoDB with UFT
 
WixAutomation - Test State Pattern - Selenium Camp 2017
WixAutomation - Test State Pattern - Selenium Camp 2017WixAutomation - Test State Pattern - Selenium Camp 2017
WixAutomation - Test State Pattern - Selenium Camp 2017
 
Angular js automation using protractor
Angular js automation using protractorAngular js automation using protractor
Angular js automation using protractor
 
How does Java 8 exert hidden power on Test Automation?
How does Java 8 exert hidden power on Test Automation?How does Java 8 exert hidden power on Test Automation?
How does Java 8 exert hidden power on Test Automation?
 
iOS Automation with Cucumber, Appium and Saucelabs
iOS Automation with Cucumber, Appium and SaucelabsiOS Automation with Cucumber, Appium and Saucelabs
iOS Automation with Cucumber, Appium and Saucelabs
 
The Right Tool for the Right Project
The Right Tool for the Right ProjectThe Right Tool for the Right Project
The Right Tool for the Right Project
 
7 plugins de la communauté à ne pas manquer ! - Liferay France Symposium 2016
7 plugins de la communauté à ne pas manquer ! - Liferay France Symposium 20167 plugins de la communauté à ne pas manquer ! - Liferay France Symposium 2016
7 plugins de la communauté à ne pas manquer ! - Liferay France Symposium 2016
 
Api testing
Api testingApi testing
Api testing
 
The wild wild west of Selenium Capabilities
The wild wild west of Selenium CapabilitiesThe wild wild west of Selenium Capabilities
The wild wild west of Selenium Capabilities
 
Roman iovlev. Test UI with JDI - Selenium camp
Roman iovlev. Test UI with JDI - Selenium campRoman iovlev. Test UI with JDI - Selenium camp
Roman iovlev. Test UI with JDI - Selenium camp
 
Ukstar 2017 london- Parasoft
Ukstar 2017 london-  ParasoftUkstar 2017 london-  Parasoft
Ukstar 2017 london- Parasoft
 

Similar to API Testing with Frisby and Mocha

To Open Banking and Beyond: Developing APIs that are Resilient to every new I...
To Open Banking and Beyond: Developing APIs that are Resilient to every new I...To Open Banking and Beyond: Developing APIs that are Resilient to every new I...
To Open Banking and Beyond: Developing APIs that are Resilient to every new I...
Curiosity Software Ireland
 
Acceptance & Functional Testing with Codeception - Devspace 2015
Acceptance & Functional Testing with Codeception - Devspace 2015 Acceptance & Functional Testing with Codeception - Devspace 2015
Acceptance & Functional Testing with Codeception - Devspace 2015
Joe Ferguson
 

Similar to API Testing with Frisby and Mocha (20)

Diving into the World of Test Automation The Approach and the Technologies
Diving into the World of Test Automation The Approach and the TechnologiesDiving into the World of Test Automation The Approach and the Technologies
Diving into the World of Test Automation The Approach and the Technologies
 
N Different Strategies to Automate OWASP ZAP - Cybersecurity WithTheBest - Oc...
N Different Strategies to Automate OWASP ZAP - Cybersecurity WithTheBest - Oc...N Different Strategies to Automate OWASP ZAP - Cybersecurity WithTheBest - Oc...
N Different Strategies to Automate OWASP ZAP - Cybersecurity WithTheBest - Oc...
 
N Different Strategies to Automate OWASP ZAP - OWASP APPSec BUCHAREST - Oct 1...
N Different Strategies to Automate OWASP ZAP - OWASP APPSec BUCHAREST - Oct 1...N Different Strategies to Automate OWASP ZAP - OWASP APPSec BUCHAREST - Oct 1...
N Different Strategies to Automate OWASP ZAP - OWASP APPSec BUCHAREST - Oct 1...
 
Performance profiling and testing of symfony application 2
Performance profiling and testing of symfony application 2Performance profiling and testing of symfony application 2
Performance profiling and testing of symfony application 2
 
To Open Banking and Beyond: Developing APIs that are Resilient to every new I...
To Open Banking and Beyond: Developing APIs that are Resilient to every new I...To Open Banking and Beyond: Developing APIs that are Resilient to every new I...
To Open Banking and Beyond: Developing APIs that are Resilient to every new I...
 
Azure API Management - why should I care?
Azure API Management - why should I care?Azure API Management - why should I care?
Azure API Management - why should I care?
 
" Performance testing for Automation QA - why and how " by Andrey Kovalenko f...
" Performance testing for Automation QA - why and how " by Andrey Kovalenko f..." Performance testing for Automation QA - why and how " by Andrey Kovalenko f...
" Performance testing for Automation QA - why and how " by Andrey Kovalenko f...
 
(Agile) engineering best practices - What every project manager should know
(Agile) engineering best practices - What every project manager should know(Agile) engineering best practices - What every project manager should know
(Agile) engineering best practices - What every project manager should know
 
AI assisted testing using postman and openAI.pdf
AI assisted testing using postman and openAI.pdfAI assisted testing using postman and openAI.pdf
AI assisted testing using postman and openAI.pdf
 
How to kill test flake in appium
How to kill test flake in appiumHow to kill test flake in appium
How to kill test flake in appium
 
Unlocking the Power of ChatGPT and AI in Testing - NextSteps, presented by Ap...
Unlocking the Power of ChatGPT and AI in Testing - NextSteps, presented by Ap...Unlocking the Power of ChatGPT and AI in Testing - NextSteps, presented by Ap...
Unlocking the Power of ChatGPT and AI in Testing - NextSteps, presented by Ap...
 
Functional Testing of RESTful Applications
Functional Testing of RESTful ApplicationsFunctional Testing of RESTful Applications
Functional Testing of RESTful Applications
 
Testistanbul 2016 - Keynote: "Why Automated Verification Matters" by Kristian...
Testistanbul 2016 - Keynote: "Why Automated Verification Matters" by Kristian...Testistanbul 2016 - Keynote: "Why Automated Verification Matters" by Kristian...
Testistanbul 2016 - Keynote: "Why Automated Verification Matters" by Kristian...
 
Acceptance & Functional Testing with Codeception - SunshinePHP 2016
Acceptance & Functional Testing with Codeception - SunshinePHP 2016Acceptance & Functional Testing with Codeception - SunshinePHP 2016
Acceptance & Functional Testing with Codeception - SunshinePHP 2016
 
Acceptance & Functional Testing with Codeception - Devspace 2015
Acceptance & Functional Testing with Codeception - Devspace 2015 Acceptance & Functional Testing with Codeception - Devspace 2015
Acceptance & Functional Testing with Codeception - Devspace 2015
 
What It Takes to Build API Integrations
What It Takes to Build API IntegrationsWhat It Takes to Build API Integrations
What It Takes to Build API Integrations
 
Agile Engineering Best Practices by Richard Cheng
Agile Engineering Best Practices by Richard ChengAgile Engineering Best Practices by Richard Cheng
Agile Engineering Best Practices by Richard Cheng
 
Building an Open Source AppSec Pipeline
Building an Open Source AppSec PipelineBuilding an Open Source AppSec Pipeline
Building an Open Source AppSec Pipeline
 
Mobile Testing
Mobile TestingMobile Testing
Mobile Testing
 
API Security - OWASP top 10 for APIs + tips for pentesters
API Security - OWASP top 10 for APIs + tips for pentestersAPI Security - OWASP top 10 for APIs + tips for pentesters
API Security - OWASP top 10 for APIs + tips for pentesters
 

Recently uploaded

%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
masabamasaba
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
masabamasaba
 

Recently uploaded (20)

VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 

API Testing with Frisby and Mocha

  • 1. How to boost your automation skills with a cup of energising Mocha Lyudmila Anisimova Olga Biletska
  • 3. Why do we value software quality? If we can’t control the quality of applications we can’t control the quality of our lives
  • 4. Have you heard about Centerlink fault? Centrelink - government company that helps families and people with low income November 2016 - New automatic debt collection system was introduced with 169 000 letters Complaints rate - only 276 complaints from those 169,000 letters (Jan 9) 4 billions will be raised What’s wrong?
  • 5. What is API? API - a set of functions and procedures that allow the creation of applications which access the features or data of an operating system, application, or other service.
  • 6. Why do we need to start with API Automation? ● Manual testing takes far longer for automated solutions ● UI Automation is usually less stable ● Maintenance of UI tests takes a significant amount of time ● Test Early and Test Often - APIs usually are implemented first
  • 7. Why automation is a quick win? This is what we get after hard work is done
  • 8. What are drawbacks of API implemented? 1. Automation can bring us false sense of security 2.Automation requires everyday support 3.Automation can delay releases
  • 9. Olga Biletska Test analyst at Digital Turbine My first experience with automated API testing
  • 10. Our project: Case 1 Testing APIs manually
  • 12. Frustration ----------> Hope Frisby! How to start? Learn this: ● How does http protocol work? ● What is API? ● What is JSON? ● Basic commands in Javascript ● How to install testing frameworks?
  • 13. What Frisby does well: •Send request/Adding headers to request •Check types and values of responses •Authorization via tokens and cookies •Allows custom methods Frisby – RESTful API testing framework
  • 14. Structure of Frisby test case Example: testing API calls to subscribe/unsubscribe user •Spec ending •Test description •Request/Response •Defining expectations •Toss Frisby General workflow: ● Identify user ● Get access token ● Subscribe call ● Unsubscribe call
  • 15. Structure of our test case: Part 1 – identify user and get access token Define variables: var Define new test: Frisby create() Perform http GET request: get() Check response code: expectStatus()
  • 16. Structure of our test case: Part 2 – verify response data Verify responses: Check type of response: expectJSONtypes Check exact values: afterJSON(function (body) {}) Matchers: Expect.toEqual Expect.toMatch What we see in the console ------->
  • 17. Structure of our test case: Part 3 – subscribe and unsubscribe user Nested test Define variables: Var Define new test: Frisby.create() Print results to console: inspectJSON() Fire the request: toss()
  • 18. Final part: running test case
  • 19. Frisby installation ● Install Node.js: https://nodejs.org/en/download/ (NPM - Node Package Manager will be installed automatically) ● Install Frisby locally: npm install frisby ● Install Jasmine node globally: npm install -g jasmine-node Useful links Frisby http://frisbyjs.com/docs/api/, https://github.com/verdverm/frisby, http://testerzero.com/up-and-running-with-frisby-js-for-api-checks/ Jasmine: https://github.com/JamieMason/Jasmine-Matchers Java Script: https://watchandcode.com/courses/enrolled/60264
  • 20. Case 2 Device Caps - this system is responsible for mapping Game/Application renditions to specified devices from Game Suppliers. It also contains the logic to find known compatibility and extend coverage on this basis. Search system module that works based on device caps functionality as the user should be able to find only content that is supported.
  • 21. Challenges Over 2000 mobile devices At least 5 main browsers At least 15 different Android OSes to test Time limitation of 2 weeks
  • 22. Boundary analysis gives unstable results
  • 23. Now this is the time for a change New automation framework should support long delays
  • 24. Installation npm install mocha npm install chai npm install should npm install joi npm install mochawesome
  • 26. Code structure “ It “ .post/.get .set .send .end .end Verify your API response status, type and other data Part II
  • 27. Response verification with chai and should res.should.have.status(200); res.should.be.json; res.body.should.be.a('array'); res.body.should.have.length(5); res.body.should.be.a('object'); res.body.should.have.property('id'); res.body.id.should.be.a('number'); res.body.name.should.equal('3JHGFJHJHKJHK2211');
  • 28. Traditional TDD interfaces in Mocha suite - similar to describe test - similar to it setup - similar to before teardown - similar to after suiteSetup - similar to beforeEach suiteTeardown - similar to afterEach
  • 30. 2465 tests in 2 minutes
  • 31.
  • 33.