SlideShare a Scribd company logo
1 of 26
Project AutoMock and Jasmine:
Testing Auto-magically!!
The inside story of how we stopped breaking our own code at Adobe…
About Me
• Neha Singhal
– Developer at Adobe.
– Active in web development and UI for the past 2.5 years.
– Likes solving interesting problems involving UI and UX
– On a personal front she is an avid dancer, loves to travel and is a big fan of
animated movies.
So how did it all begin??
3
Our Journey @ Adobe
4
Version 2.0 Version 3.0
Bugs by QA Team 156 15 (so far)
Regression Bugs 52 0 (so far)
Integration Bugs > 50 < 5
Bug fixing (in days) ~14 ~3
Dev validation before handoff 5 days 4 hours
Dead code (lines) ~1470 < 50
Impressed? This isn’t even the best part!
Still think testing isn’t important??
<video>
TDD: The Basics
• Development Philosophy
• Execution steps :
– Add a test
– Watch it fail (Cry silently)
– Write Code
– Watch It Pass
– Celebrate
– Repeat!
TEST
CODE
DEPLOY
INTEGRATE
RELEASE
Jasmine is..
A Beautiful Disney Princess ?
Just Kidding..
Jasmine is..
• Javascript Testing Framework
• Independent of browsers, DOM
• Supports multiple Javascript frameworks
• Headless running out of the box
• Clean Syntax
Our first baby steps...
9
Let’s meet our mighty heroes...
• Suite : to describe a section of your code
• Specs: it creates a new spec
• Expectations : what you expect the code block to do
Let’s meet our mighty heroes...
• Matchers : utility functions
– toEqual
– toMatch
– toBeTruthy
– And lots more to list here..
With great power…
comes an easy way to
write a test case...
12
With Great Power…
We can even create one of our own !! 
Before we knew it…
We were all grown up…
14
Unpredictable Minions of Jasmine
(Async callbacks)
• You never know when and what they are going to do.. (just
like async callbacks)
• Jasmine now supports async methods through done leaving it
up to the developer to control the execution flow.
• Setup
– Jasmine lets you setup tests by running code before all/each test
• Teardown
– You can also run cleanup after all tests or after each test
Let’s pull the rabbit out of the hat..
• What if we told you there was a way to
automatically mock your entire backend without
having to touch the source code or add specific test
code…
– Feels like magic doesn’t it?
.
.
.
.
.
.
Wait for it..
Let’s pull the rabbit out of the hat..
Introducing…
“Project AutoMock”!!
Project AutoMock
Project AutoMock is an original project we are
developing for mocking the entire backend
Tired??
• Tired of waiting for the backend API to be ready?
• Tired of waiting for API calls to return in your test cases?
• Tired of test data ruining your DB?
• Tired of the long, slow process of stubbing each and
every API call?
Yeah. So were we…
Let me tell you what we did about it…
Why Tell You…
When I Can Show You…
20
What it does
• Automatically captures AJAX requests and responses
• Integrates well with testing frameworks like Jasmine
• Automatically creates API stubs for testing using the
real captured data
The Best Part…
• Integration Guide:
– For React.js
– For Angular.js
– For Backbone.js
Spot The Difference 
What we have achieved so far
• No manual effort at all
– Mocking API calls is now essentially an automatic process
– Little to no developer intervention required to create the API stubs
• Built for speed
– Test cases run much faster now that no network requests are made
– The testing process is speed up considerably
• Test cases for AJAX calls no longer require async test cases. It’s
instantaneous.
• No more messy code required to test each API call
It’s not the end…
It’s the beginning of a
new era…
24
What good are questions...
…without answers!!
Thank You!!
@Neha_Singhal

More Related Content

What's hot

Scale like a pro with Gearman
Scale like a pro with GearmanScale like a pro with Gearman
Scale like a pro with Gearman
Amal Raghav
 

What's hot (20)

JSFoo-2017 Takeaways
JSFoo-2017 TakeawaysJSFoo-2017 Takeaways
JSFoo-2017 Takeaways
 
TDD in the Web with Python and Django
TDD in the Web with Python and DjangoTDD in the Web with Python and Django
TDD in the Web with Python and Django
 
Are you new to Apache Camel
Are you new to Apache CamelAre you new to Apache Camel
Are you new to Apache Camel
 
Introduction to cypress in Angular (Chinese)
Introduction to cypress in Angular (Chinese)Introduction to cypress in Angular (Chinese)
Introduction to cypress in Angular (Chinese)
 
Jellyfish, JSCONF 2011
Jellyfish, JSCONF 2011Jellyfish, JSCONF 2011
Jellyfish, JSCONF 2011
 
Selenium and Appium Training from Sauce Labs
Selenium and Appium Training from Sauce LabsSelenium and Appium Training from Sauce Labs
Selenium and Appium Training from Sauce Labs
 
Cypress first impressions
Cypress first impressionsCypress first impressions
Cypress first impressions
 
Cypress vs Selenium WebDriver: Better, Or Just Different? -- by Gil Tayar
Cypress vs Selenium WebDriver: Better, Or Just Different? -- by Gil TayarCypress vs Selenium WebDriver: Better, Or Just Different? -- by Gil Tayar
Cypress vs Selenium WebDriver: Better, Or Just Different? -- by Gil Tayar
 
Cypress testing
Cypress testingCypress testing
Cypress testing
 
Developers’ mDay 2021: Mladen Janjetović, Laravel Srbija – Laravel Awesome
Developers’ mDay 2021: Mladen Janjetović, Laravel Srbija – Laravel AwesomeDevelopers’ mDay 2021: Mladen Janjetović, Laravel Srbija – Laravel Awesome
Developers’ mDay 2021: Mladen Janjetović, Laravel Srbija – Laravel Awesome
 
Progressive Web App Testing With Cypress.io
Progressive Web App Testing With Cypress.ioProgressive Web App Testing With Cypress.io
Progressive Web App Testing With Cypress.io
 
MVVM+Router with Swift
MVVM+Router with SwiftMVVM+Router with Swift
MVVM+Router with Swift
 
Scale like a pro with Gearman
Scale like a pro with GearmanScale like a pro with Gearman
Scale like a pro with Gearman
 
Gearman, Supervisor and PHP - Job Management with Sanity!
Gearman, Supervisor and PHP - Job Management with Sanity!Gearman, Supervisor and PHP - Job Management with Sanity!
Gearman, Supervisor and PHP - Job Management with Sanity!
 
QA Challenge Accepted 4.0 - Cypress vs. Selenium
QA Challenge Accepted 4.0 - Cypress vs. SeleniumQA Challenge Accepted 4.0 - Cypress vs. Selenium
QA Challenge Accepted 4.0 - Cypress vs. Selenium
 
Protractor survival guide
Protractor survival guideProtractor survival guide
Protractor survival guide
 
How to Use Selenium, Successfully
How to Use Selenium, SuccessfullyHow to Use Selenium, Successfully
How to Use Selenium, Successfully
 
Automated testing with Cypress
Automated testing with CypressAutomated testing with Cypress
Automated testing with Cypress
 
Testing the way it should be
Testing the way it should beTesting the way it should be
Testing the way it should be
 
Introduction to Integration Testing With Cypress
Introduction to Integration Testing With CypressIntroduction to Integration Testing With Cypress
Introduction to Integration Testing With Cypress
 

Similar to Tdd final submission

Introduction to-automated-testing
Introduction to-automated-testingIntroduction to-automated-testing
Introduction to-automated-testing
BestBrains
 

Similar to Tdd final submission (20)

Test driven development with Jasmine
Test driven development with JasmineTest driven development with Jasmine
Test driven development with Jasmine
 
Battle for Code Quality - A Story of One Java Project
Battle for Code Quality - A Story of One Java ProjectBattle for Code Quality - A Story of One Java Project
Battle for Code Quality - A Story of One Java Project
 
Automated Acceptance Testing from Scratch
Automated Acceptance Testing from ScratchAutomated Acceptance Testing from Scratch
Automated Acceptance Testing from Scratch
 
Test Driven Development and Automation
Test Driven Development and AutomationTest Driven Development and Automation
Test Driven Development and Automation
 
Reliable mobile test automation
Reliable mobile test automationReliable mobile test automation
Reliable mobile test automation
 
Jest: Frontend Testing richtig gemacht @WebworkerNRW
Jest: Frontend Testing richtig gemacht @WebworkerNRWJest: Frontend Testing richtig gemacht @WebworkerNRW
Jest: Frontend Testing richtig gemacht @WebworkerNRW
 
iOS Test-Driven Development
iOS Test-Driven DevelopmentiOS Test-Driven Development
iOS Test-Driven Development
 
How engineering practices help business
How engineering practices help businessHow engineering practices help business
How engineering practices help business
 
Code Palousa presentation- "Giving Digital Eyes to your Synthetic Tests"
Code Palousa presentation- "Giving Digital Eyes to your Synthetic Tests"Code Palousa presentation- "Giving Digital Eyes to your Synthetic Tests"
Code Palousa presentation- "Giving Digital Eyes to your Synthetic Tests"
 
Hadoop Demystified + Automation Smackdown! Austin JUG June 24 2014
Hadoop Demystified + Automation Smackdown!  Austin JUG June 24 2014Hadoop Demystified + Automation Smackdown!  Austin JUG June 24 2014
Hadoop Demystified + Automation Smackdown! Austin JUG June 24 2014
 
Introduction to Automated Testing
Introduction to Automated TestingIntroduction to Automated Testing
Introduction to Automated Testing
 
Introduction to-automated-testing
Introduction to-automated-testingIntroduction to-automated-testing
Introduction to-automated-testing
 
Agile, DevOps & Test
Agile, DevOps & TestAgile, DevOps & Test
Agile, DevOps & Test
 
Scaling Your Tests: Continued Change Without Fear
Scaling Your Tests: Continued Change Without FearScaling Your Tests: Continued Change Without Fear
Scaling Your Tests: Continued Change Without Fear
 
Building High Quality Android Applications
Building High Quality Android ApplicationsBuilding High Quality Android Applications
Building High Quality Android Applications
 
Graceful Failure with Selenium and Continuous Integration
Graceful Failure with Selenium and Continuous IntegrationGraceful Failure with Selenium and Continuous Integration
Graceful Failure with Selenium and Continuous Integration
 
AWS Lambda from the trenches (Serverless London)
AWS Lambda from the trenches (Serverless London)AWS Lambda from the trenches (Serverless London)
AWS Lambda from the trenches (Serverless London)
 
An Introduction To Software Development - Test Driven Development, Part 1
An Introduction To Software Development - Test Driven Development, Part 1An Introduction To Software Development - Test Driven Development, Part 1
An Introduction To Software Development - Test Driven Development, Part 1
 
Great! another bug
Great! another bugGreat! another bug
Great! another bug
 
Test Driven Development with Laravel
Test Driven Development with LaravelTest Driven Development with Laravel
Test Driven Development with Laravel
 

Recently uploaded

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Recently uploaded (20)

presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 

Tdd final submission

  • 1. Project AutoMock and Jasmine: Testing Auto-magically!! The inside story of how we stopped breaking our own code at Adobe…
  • 2. About Me • Neha Singhal – Developer at Adobe. – Active in web development and UI for the past 2.5 years. – Likes solving interesting problems involving UI and UX – On a personal front she is an avid dancer, loves to travel and is a big fan of animated movies.
  • 3. So how did it all begin?? 3
  • 4. Our Journey @ Adobe 4 Version 2.0 Version 3.0 Bugs by QA Team 156 15 (so far) Regression Bugs 52 0 (so far) Integration Bugs > 50 < 5 Bug fixing (in days) ~14 ~3 Dev validation before handoff 5 days 4 hours Dead code (lines) ~1470 < 50 Impressed? This isn’t even the best part!
  • 5. Still think testing isn’t important?? <video>
  • 6. TDD: The Basics • Development Philosophy • Execution steps : – Add a test – Watch it fail (Cry silently) – Write Code – Watch It Pass – Celebrate – Repeat! TEST CODE DEPLOY INTEGRATE RELEASE
  • 7. Jasmine is.. A Beautiful Disney Princess ?
  • 8. Just Kidding.. Jasmine is.. • Javascript Testing Framework • Independent of browsers, DOM • Supports multiple Javascript frameworks • Headless running out of the box • Clean Syntax
  • 9. Our first baby steps... 9
  • 10. Let’s meet our mighty heroes... • Suite : to describe a section of your code • Specs: it creates a new spec • Expectations : what you expect the code block to do
  • 11. Let’s meet our mighty heroes... • Matchers : utility functions – toEqual – toMatch – toBeTruthy – And lots more to list here..
  • 12. With great power… comes an easy way to write a test case... 12
  • 13. With Great Power… We can even create one of our own !! 
  • 14. Before we knew it… We were all grown up… 14
  • 15. Unpredictable Minions of Jasmine (Async callbacks) • You never know when and what they are going to do.. (just like async callbacks) • Jasmine now supports async methods through done leaving it up to the developer to control the execution flow. • Setup – Jasmine lets you setup tests by running code before all/each test • Teardown – You can also run cleanup after all tests or after each test
  • 16. Let’s pull the rabbit out of the hat.. • What if we told you there was a way to automatically mock your entire backend without having to touch the source code or add specific test code… – Feels like magic doesn’t it? . . . . . . Wait for it..
  • 17. Let’s pull the rabbit out of the hat.. Introducing… “Project AutoMock”!!
  • 18. Project AutoMock Project AutoMock is an original project we are developing for mocking the entire backend
  • 19. Tired?? • Tired of waiting for the backend API to be ready? • Tired of waiting for API calls to return in your test cases? • Tired of test data ruining your DB? • Tired of the long, slow process of stubbing each and every API call? Yeah. So were we… Let me tell you what we did about it…
  • 20. Why Tell You… When I Can Show You… 20
  • 21. What it does • Automatically captures AJAX requests and responses • Integrates well with testing frameworks like Jasmine • Automatically creates API stubs for testing using the real captured data
  • 22. The Best Part… • Integration Guide: – For React.js – For Angular.js – For Backbone.js Spot The Difference 
  • 23. What we have achieved so far • No manual effort at all – Mocking API calls is now essentially an automatic process – Little to no developer intervention required to create the API stubs • Built for speed – Test cases run much faster now that no network requests are made – The testing process is speed up considerably • Test cases for AJAX calls no longer require async test cases. It’s instantaneous. • No more messy code required to test each API call
  • 24. It’s not the end… It’s the beginning of a new era… 24
  • 25. What good are questions... …without answers!!