SlideShare a Scribd company logo
Eradicate Flaky Tests
@BagmarAnand
Anand Bagmar
Software Quality Evangelist
@BagmarAnand
About Me
BagmarAnand
https://www.linkedin.com/in/anandbagmar/
Typical Architecture
@BagmarAnand
@BagmarAnand
Internet Internal
B2C
App
Product DB
DBMS
B2B
App
Caching System
Elastic Search
Authentication
Gateway
Service 3
Service 4
Service 7
Service 5
Service 6
Admin
User DB
Outgoing
Notification
Onboarding
Event
Consumer
Order DB
Reporting System
Admin
Portal
Support
Msg Q
Direct API
Service 2
Notification
Service 1
Event
Processor
Service 8
Payment Gateway
Credit System
Master Product
Warehouse
Royalty system
Offers
….
….
….
Approach for
API Workflow & E2E Test
Execution
@BagmarAnand
API
workflow
Tests
E2E
Functional
UI Tests
@BagmarAnand
Internet Internal
B2C
App
Product DB
DBMS
B2B
App
Caching System
Elastic Search
Authentication
Gateway
Service 3
Service 4
Service 7
Service 5
Service 6
Admin
User DB
Outgoing
Notification
Onboarding
Event
Consumer
Order DB
Reporting System
Admin
Portal
Support
Msg Q
Direct API
Service 2
Notification
Service 1
Event
Processor
Service 8
Payment Gateway
Credit System
Master Product
Warehouse
Royalty system
Offers
….
….
….
• Long running scenarios
• Slow feedback
Challenges of E2E Test Automation
@BagmarAnand
• Limitations of automatable scenarios
• Error case / Edge case handling from dependent systems
• Triggers from external systems
Challenges of E2E Test Automation
@BagmarAnand
• Pain of Cross-Browser / Cross-Device execution
• Slow, special handling for browsers/devices, infrastructure cost /
maintenance
Challenges of E2E Test Automation
@BagmarAnand
• Flaky Tests
Challenges of E2E Test Automation
@BagmarAnand
Why are Tests Flaky?
@BagmarAnand
A few solutions to reduce
flakiness in automated tests
@BagmarAnand
• Reduce number of UI tests
• Remove external dependencies via Intelligent Virtualization
• Use Visual Assertions instead of Functional Assertions
Reduce Flakiness in Automated Tests
@BagmarAnand
#1
Reduce the number of UI Tests
@BagmarAnand
Automation
@BagmarAnand
#2
Intelligent Virtualization to
Eradicate Dependencies
@BagmarAnand
Typical Architecture
@BagmarAnand
@BagmarAnand
Internet Internal
B2C
App
Product DB
DBMS
B2B
App
Caching System
Elastic Search
Authentication
Gateway
Service 3
Service 4
Service 7
Service 5
Service 6
Admin
User DB
Outgoing
Notification
Onboarding
Event
Consumer
Order DB
Reporting System
Admin
Portal
Support
Msg Q
Direct API
Service 2
Notification
Service 1
Event
Processor
Service 8
Payment Gateway
Credit System
Master Product
Warehouse
Royalty system
Offers
….
….
….
Approach for API Workflow &
E2E Test Automation
@BagmarAnand
API
workflow
Tests
E2E
Functional
UI Tests
@BagmarAnand
Internet Internal
B2C
App
Product DB
DBMS
B2B
App
Caching System
Elastic Search
Authentication
Gateway
Service 3
Service 4
Service 7
Service 5
Service 6
Admin
User DB
Outgoing
Notification
Onboarding
Event
Consumer
Order DB
Reporting System
Admin
Portal
Support
Msg Q
Direct API
Service 2
Notification
Service 1
Event
Processor
Service 8
Payment Gateway
Credit System
Master Product
Warehouse
Royalty system
Offers
….
….
….
Example
@BagmarAnand
@BagmarAnand
Step #1:
• Test calls Service 2
Step #2:
• Service 2 calls the external
service, which may
(unexpectedly) take long
time to respond
Step #3:
• Service 2 gets an error back
from external service
• Returns an error to the test
Step #4:
• Test fails because of
external service
• We may get
incorrect error as
well!
Test Scenario
Challenge!
Scenarios having external
dependencies are flaky
@BagmarAnand
Solution
@BagmarAnand
Stub it out using Specmatic!
@BagmarAnand
specmatic.in github.com/znsio/Specmatic
• Inculcates Contract Driven Development
• Supports OpenAPI Spec
• Executable Contract spec
• Defines http method, path, header format, payload format, query parameter format, form field payload format
• Supports JSON, XML data formats
• Supports Kafka
• Dynamically generates and executes contract tests
• Apt for service virtualization
• Compares contracts to ascertain backward compatibility
• Manages contracts through versioning
• Integrates with CI/CD
Specmatic – Contract Driven Development
@BagmarAnand
• Decouples the ”producers” and “consumers”, with confidence!
Use Specmatic as part of Test execution
Stubbed
using
Specmatic
@BagmarAnand
Step #3:
• Test calls Service 2
Step #4:
• Service 2 calls the
stubbed external service
Step #2:
• Test sets expectations on Specmatic for
specific stubbed endpoint
• Http POST call on Specmatic server with
exact request & response as json payload
Step #5:
• If request matches set expectation, corresponding set
response is returned in response
• Service 2 processes response and responds to test
appropriately
Step #6:
• Test asserts on the
received response
• Test passes
Step #1. Specmatic as a Stub Server in your Test
Environment
• Specmatic Server is started in the Stub mode in
the Environment
• External services are stubbed out
• Internal services point to Specmatic stubbed-
endpoints instead of real external endpoints
Use Specmatic as part of Test execution
@BagmarAnand
Step #3:
• Test calls Service 2
Step #4:
• Service 2 calls the
stubbed external service
Step #2:
• Test sets expectations on Specmatic for
specific stubbed endpoint
• Http POST call on Specmatic server with
exact request & response as json payload
Step #5:
• If request matches set expectation, corresponding set
response is returned in response
• Service 2 processes response and responds to test
appropriately
Step #6:
• Test asserts on the
received response
• Test passes
Step #1. Specmatic as a Stub Server
• Specmatic Server is started in the Stub mode in
the Environment
• External services are stubbed out
• Internal services point to Specmatic stubbed-
endpoints instead of real external endpoints
Allows to simulate positive,
negative, edge-case responses –
allowing you to test your
implementation logic
Example
@BagmarAnand
@BagmarAnand
Application under test
Login
Get list of users
Edit User
Test Scenario
Login 1
Get list of users 2
Internet
Return dynamic
list of users
3
4
Edit User 5
Verify User
Details
6
Return dynamic
list of users
Test Scenario
Example Scenario
Website with rest services in
backend hosted on local machine
Login
Get list of users
Edit User
Test Scenario
Functional
& Visual
Assertions
using
Applitools
Login 1
Get list of users
3
Verify User
Details
7
Edit User
6
4
5
Test Environment
Return dynamic
list of users
Stubbed
using
Specmatic
Static
Random
Dynamic
Expectations
@BagmarAnand
2. Test sets “dynamic
expectation” in context
of the scenario
Example Scenario using Specmatic
I
n
t
e
r
n
e
t
@BagmarAnand
Example Scenario using Specmatic
Website with rest services in
backend hosted on local machine
Login
Get list of users
Edit User
Test Scenario
Functional
& Visual
Assertions
using
Applitools
Login 1
Get list of users
3
Verify User
Details
7
Edit User
6
4
5
Test Environment
Return dynamic
list of users
Stubbed
using
Specmatic
Static
Random
Dynamic
Expectations
2. Test sets “dynamic
expectation” in context
of the scenario
I
n
t
e
r
n
e
t
Return dynamic
list of users
Test Scenario
#3
Visual Assertions instead of
Functional Assertions
@BagmarAnand
Automation
@BagmarAnand
Bugs still escape
@BagmarAnand
Traditional automated testing frameworks are not built for modern apps
@BagmarAnand
Bugs escape because our approach to
testing is incorrect
@BagmarAnand
39
@BagmarAnand
Spot the Difference!
40
@BagmarAnand
Spot the Difference!
41
@BagmarAnand
Spot the Difference!
42
@BagmarAnand
Spot the Difference!
@BagmarAnand
Mundane
Error prone
Tedious
Running against Time
Approach to Testing is Incorrect
But, we are testing real
software products
@BagmarAnand
45
@BagmarAnand
Text, Images, Responsive-pages,
Form-factors, User-experience
Product has Context!
Bugs still Escape
@BagmarAnand
Bugs still Escape
@BagmarAnand
Bugs still Escape
@BagmarAnand
Bugs still Escape
@BagmarAnand
Bugs still Escape
@BagmarAnand
@BagmarAnand
The Way Forward!
@BagmarAnand
Computer Vision
that replicates
the human eye and brain
@BagmarAnand
Visual AI
@BagmarAnand
Visual AI detects bugs, not browser render
diffs
@BagmarAnand
Pixel comparisons waste time with false
positives
Visual AI should work across all Platforms
PDF, Web, Native Mobile
@BagmarAnand
Perfection Across All Screens, Browsers and
Viewports
Tests run local - Applitools
SDKs available for all major
testing frameworks DOM & CSS sent to
Applitools Ultrafast Grid
Applitools Eyes
Visual AI analysis
Ultrafast Grid renders
DOM snapshots in parallel
Login to Eyes to
view test results
58
.
Firewall
Product Quality
@BagmarAnand
Demo
@BagmarAnand
Summary
@BagmarAnand
• Reduce number of UI tests – Test Pyramid
• Remove external dependencies via Intelligent Virtualization
• Use Visual Assertions instead of Functional Assertions
Make your Automation Intelligent!
@BagmarAnand
• Move granular tests to lower layers of pyramid
• Get faster feedback
• Reduce flakiness / brittleness due to UI changes
Reduce UI tests
@BagmarAnand
• Test environment independent of external dependencies
• Tests set dynamic expectations based on context of the
test execution
• Stubbed service should be able to give static responses /
random responses
Virtualize Dependencies at Runtime
@BagmarAnand
• A single assertion for complete
functional coverage
• Bonus: validates the UI
• Does not break when the UI changes
• No coding skills required to maintain
baselines
• Validate UX at scale for all supported
browsers
Use Visual Assertions
@BagmarAnand
Run once, validate everywhere
@BagmarAnand
• Visual AI using Applitools
• Getting Started with Visual Testing - https://testautomationu.applitools.com/automated-
visual-testing-a-fast-path-to-test-automation-success/
• Modern Functional Test Automation Through Visual AI -
https://testautomationu.applitools.com/modern-functional-testing/
• Intelligent Virtualization using Specmatic
• https://specmatic.in/
• https://github.com/znsio/specmatic
• Test Automation University - https://testautomationu.applitools.com/
• Test Pyramid - https://martinfowler.com/articles/practical-test-pyramid.html
Resources
@BagmarAnand
BagmarAnand
https://www.linkedin.com/in/anandbagmar/
Thank You

More Related Content

PPTX
Software testing principles
PDF
Unit Testing with Jest
PPTX
Snapchat presentation
PDF
A story of the passive aggressive sysadmin of AEM
PDF
Defying Logic - Business Logic Testing with Automation
PPTX
Angular Best Practices To Build Clean and Performant Web Applications
PDF
Introduction to jest
PDF
개발자 이승우 이력서 (2016)
Software testing principles
Unit Testing with Jest
Snapchat presentation
A story of the passive aggressive sysadmin of AEM
Defying Logic - Business Logic Testing with Automation
Angular Best Practices To Build Clean and Performant Web Applications
Introduction to jest
개발자 이승우 이력서 (2016)

What's hot (20)

PDF
OWASP AppSecEU 2018 – Attacking "Modern" Web Technologies
PDF
Attendance Management System
PPTX
Snapchat
PPTX
FIDO Alliance Research: Consumer Attitudes Towards Authentication
PPTX
API & Backend Integration
PDF
Android Malware Detection Mechanisms
PPTX
классы эквивалентности
PDF
Native mobile application development with Flutter (Dart)
PDF
코드 리뷰의 또 다른 접근 방법: Pull Requests vs. Stacked Changes
PDF
online quiz application project presentation
PPTX
Combinatorial testing ppt
PDF
Word2Vec model to generate synonyms on the fly in Apache Lucene.pdf
PDF
Nem tudo é Pepino: Cucumber x Robot Framework
PDF
BugBounty Tips.pdf
DOC
Testing documents
PPTX
Snapchat
PPTX
QA. Load Testing
PDF
NextJS - Online Summit for Frontend Developers September 2020
PDF
Offzone | Another waf bypass
PDF
Learning React - I
OWASP AppSecEU 2018 – Attacking "Modern" Web Technologies
Attendance Management System
Snapchat
FIDO Alliance Research: Consumer Attitudes Towards Authentication
API & Backend Integration
Android Malware Detection Mechanisms
классы эквивалентности
Native mobile application development with Flutter (Dart)
코드 리뷰의 또 다른 접근 방법: Pull Requests vs. Stacked Changes
online quiz application project presentation
Combinatorial testing ppt
Word2Vec model to generate synonyms on the fly in Apache Lucene.pdf
Nem tudo é Pepino: Cucumber x Robot Framework
BugBounty Tips.pdf
Testing documents
Snapchat
QA. Load Testing
NextJS - Online Summit for Frontend Developers September 2020
Offzone | Another waf bypass
Learning React - I
Ad

Similar to Eradicate Flaky Tests (20)

PDF
Eradicate Flaky Tests - AppiumConf 2021
PDF
Autonomous End-to-End Testing for Online Banking Applications Presented with ...
PDF
Getting Started with Visual Testing
PDF
Next Generation Functional & Visual Testing powered by AI
PPTX
Rapise Overview Presentation (2025 Update)
PDF
Integrating AI in software quality in absence of a well-defined requirements
PDF
The Path to Autonomous Testing - Anand Bagmar
PDF
"Software Quality in the Service of Innovation in the Insurance Industry"
PPTX
Real Testing Scenario Strategy Practical TestOps Presentation
PPTX
Curiosity and Infuse Consulting Present: Sustainable Test Automation Strategi...
PDF
Visual Validation - The missing tip of the automation pyramid @GoT2022
PPTX
Diving into the World of Test Automation The Approach and the Technologies
PDF
Does your functional automation really add value?
PDF
Unlocking the Power of ChatGPT and AI in Testing - NextSteps, presented by Ap...
PPTX
Testplant: 10 Steps to State of the Art Software Testing
PDF
Web Services Testing Best Practices: Secure, Reliable, and Scalable APIs
PPTX
Hindsight lessons about API testing
PPTX
D-CAST Real Life TestOps Environment
PDF
Conquer 6 Testing Challenges_Applitools.pdf
PPTX
To Open Banking and Beyond: Developing APIs that are Resilient to every new I...
Eradicate Flaky Tests - AppiumConf 2021
Autonomous End-to-End Testing for Online Banking Applications Presented with ...
Getting Started with Visual Testing
Next Generation Functional & Visual Testing powered by AI
Rapise Overview Presentation (2025 Update)
Integrating AI in software quality in absence of a well-defined requirements
The Path to Autonomous Testing - Anand Bagmar
"Software Quality in the Service of Innovation in the Insurance Industry"
Real Testing Scenario Strategy Practical TestOps Presentation
Curiosity and Infuse Consulting Present: Sustainable Test Automation Strategi...
Visual Validation - The missing tip of the automation pyramid @GoT2022
Diving into the World of Test Automation The Approach and the Technologies
Does your functional automation really add value?
Unlocking the Power of ChatGPT and AI in Testing - NextSteps, presented by Ap...
Testplant: 10 Steps to State of the Art Software Testing
Web Services Testing Best Practices: Secure, Reliable, and Scalable APIs
Hindsight lessons about API testing
D-CAST Real Life TestOps Environment
Conquer 6 Testing Challenges_Applitools.pdf
To Open Banking and Beyond: Developing APIs that are Resilient to every new I...
Ad

More from Anand Bagmar (20)

PDF
My Journey With Appium @AppiumConf Sept 2024
PDF
Streamlining End-to-End Testing Automation
PDF
Automating the real-user scenarios across multi-apps, and multi-devices
PDF
Design Patterns in Automation
PDF
Change Tyres In A Moving Car - Make Functional Test Automation Effective Keynote
PDF
Rewrite vs Refactor (AgileIndia 2021)
PDF
The Best Test Automation Framework is...
PDF
Getting started with Appium 2.0
PDF
Visual Validation - The missing tip of the automation pyramid @AgileIndia2020
PDF
Selenium Deep Dive
PDF
Measuring Coverage From E2E Tests
PDF
Getting started with Visual Testing using Applitools - @TPC, Feb2020
PDF
Visual validation - The missing tip of the automation pyramid @ QA Symposium
PDF
Collaboration - A Taboo!
PDF
Visual Validation - The Missing Tip of the Automation Pyramid
PDF
Measuring Consumer Quality - The Missing Feedback Loop
PDF
What is Agile Testing? How does Automation help?
PDF
The What, Why and How of Analytics Testing
PDF
Patterns of a “good” test automation framework
PDF
Client-Side Performance Testing
My Journey With Appium @AppiumConf Sept 2024
Streamlining End-to-End Testing Automation
Automating the real-user scenarios across multi-apps, and multi-devices
Design Patterns in Automation
Change Tyres In A Moving Car - Make Functional Test Automation Effective Keynote
Rewrite vs Refactor (AgileIndia 2021)
The Best Test Automation Framework is...
Getting started with Appium 2.0
Visual Validation - The missing tip of the automation pyramid @AgileIndia2020
Selenium Deep Dive
Measuring Coverage From E2E Tests
Getting started with Visual Testing using Applitools - @TPC, Feb2020
Visual validation - The missing tip of the automation pyramid @ QA Symposium
Collaboration - A Taboo!
Visual Validation - The Missing Tip of the Automation Pyramid
Measuring Consumer Quality - The Missing Feedback Loop
What is Agile Testing? How does Automation help?
The What, Why and How of Analytics Testing
Patterns of a “good” test automation framework
Client-Side Performance Testing

Recently uploaded (20)

PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PDF
Understanding Forklifts - TECH EHS Solution
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PPTX
history of c programming in notes for students .pptx
PDF
Nekopoi APK 2025 free lastest update
PDF
System and Network Administraation Chapter 3
PPTX
Transform Your Business with a Software ERP System
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PPTX
ai tools demonstartion for schools and inter college
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PPTX
ISO 45001 Occupational Health and Safety Management System
PPTX
Operating system designcfffgfgggggggvggggggggg
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
Odoo Companies in India – Driving Business Transformation.pdf
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
How to Choose the Right IT Partner for Your Business in Malaysia
Understanding Forklifts - TECH EHS Solution
Internet Downloader Manager (IDM) Crack 6.42 Build 41
history of c programming in notes for students .pptx
Nekopoi APK 2025 free lastest update
System and Network Administraation Chapter 3
Transform Your Business with a Software ERP System
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
ai tools demonstartion for schools and inter college
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
Which alternative to Crystal Reports is best for small or large businesses.pdf
ISO 45001 Occupational Health and Safety Management System
Operating system designcfffgfgggggggvggggggggg

Eradicate Flaky Tests