SlideShare uma empresa Scribd logo
Melissa Benua / Sr Director of Engineering
Test Design for Fully
Automated Build
Architectures
STARWEST 2023
ABOUT ME
Melissa Benua
Sr Director of Engineering,
Platform
mParticle
Get in touch!
mbenua@gmail.com
@queenofcode
Follow my work!
https://www.linkedin.com/in/mbe
nua/
https://www.slideshare.net/Meliss
aBenua/
https://github.com/queen-of-
code/
https://www.queenofcode.net @QUEENOFCODE
ABOUT THE TUTORIAL
1. Track Work
Ensure the right
change is being
made
2. Write Code +
Tests
Keep prod and test
code together in
source control
3. Request a Peer
Review
Automated system to run
build + unit test + static
6. Monitor Change in
Prod
Ensure nothing
unexpected happened
with the change
5. Merge Peer
Review
Land code + tests
together for
deployment
4. Deploy Change for
Testing
Validate the change
works in a prod-like
@QUEENOFCODE
KEY SECTIONS
Learning
continuous test
case principles
and features
1
Defining the
continuous
integration
pipeline
2
Categorizing test
cases into suites
3
Leveraging
observability to
backstop testing
4
@QUEENOFCODE
Continuous Test Case
Principles
WHAT ARE WE DOING HERE?
01 Unit
Tests
02 Automated
Tests
03 Semi/Manual
Tests
TEST CASE PYRAMID
@QUEENOFCODE
TEST CASE KEY FEATURES
Speedy
Reliable
Specific
@QUEENOFCODE
SPEED
Actionab
le
results
ASAP
Don’t try
to cover
every
scenario
Run the
most
importa
nt tests
first
Understa
nd what
failures
can be
tolerated
@QUEENOFCODE
SPEED
Build Failure? UI Test Failure?
@QUEENOFCODE
RELIABILITY
Not
flakey
Has no
false-
negative
s or
false-
positives
Cleans
up after
itself
Repeatabl
e without
human
interventi
on
@QUEENOFCODE
RELIABILITY
@QUEENOFCODE
SPECIFICITY
Doesn’t
boil the
ocean
Is a clear
answer
to a
clear
question
Minimiz
es
overlaps
in
coverage
Has one
main
goal
@QUEENOFCODE
SPECIFICITY
@QUEENOFCODE
PROCEED WITH CAUTION
Shared
resource
reliance
1
Single-
threading
2
Long
duration test
time
3
Caching
4
@QUEENOFCODE
EXERCISE: TEST CASES
Photo
Gallery Site
UX FrontEnd
(HTML5 + JS)
Logic BackEnd
(Java)
Data Store
(NoSQL)
• What to test?
• All ideas are good
ideas!
@QUEENOFCODE
Continuous Test
Categorization
WHAT DOES IT LOOK LIKE?
CI + CD PIPELINE
1. Track Work
Ensure the right
change is being
made
2. Write Code +
Tests
Keep prod and test
code together in
source control
3. Request a Peer
Review
Automated system to run
build + unit test + static
6. Monitor Change in
Prod
Ensure nothing
unexpected happened
with the change
5. Merge Peer
Review
Land code + tests
together for
deployment
4. Deploy Change for
Testing
Validate the change
works in a prod-like
@QUEENOFCODE
UNIT TEST GUIDELINES
Does not cross application
boundaries
Should support parallelism
Textual `Input -> Output` validation
Does NOT leave the box
@QUEENOFCODE
BEYOND UNIT TESTS
Build
•Compile change against
mainline
•Execute unit tests
Deploy
•Deploy change to testing
environment
•Execute integration tests
Validate
•Execute UI + load tests
•Manual signoff
•Monitoring signoff
• Project structure?
• Moving parts?
• Functional
boundaries?
• Shared resources?
• Mocking potential?
@QUEENOFCODE
AUTOMATED INTEGRATION TEST
GUIDELINES
Crosses application boundaries
Does not require manual
intervention
Simple `Input -> Output` validation
Follows user application flow
@QUEENOFCODE
AUTOMATED VS SEMI-AUTOMATED
TESTS
@QUEENOFCODE
Automated
•Reliable
•Fast
•Repeatable
•Specific
Semi-Automated to
Manual
•Important
•Complex
•Difficult to
Progammatically
Enumerate
SEMI-AUTOMATED TEST
GUIDELINES
Crosses many boundaries
Requires manual intervention or
setup
Complex validation
Validates non-functional
scenarios
@QUEENOFCODE
MORE DEFINITIONS
@QUEENOFCODE
Functional Testing
Testing that
validates
functionality is
working as
intended in
requirements
(usually an
automated test)
Non-Functional
Testing
Testing that
validates aspects
like security,
performance,
scalability, etc of
the software
Smoke Test Suite
Suite of functional
automated tests
that validates the
Minimum Viable
Product
Regression Test Suite
Suite of functional
automated tests
that validates the
Minimum Lovable
Product
EXAMPLE SERVICE ARCHITECTURE
UI App
JS Framework
ASP Frontend
Web Server
Backend App
Auth Service
RESTful API
Cache Service
Data Layer
Database
File Storage
@QUEENOFCODE
TEST FLOW
Build Change 01
Compile
Code
Run Unit
Tests
Create App
Package
02
Deploy App
Package
03
Validate
Product
04
Package
code
Create
Docker
image
Deploy app /
start Docker
container
Run Auto
Tests
Run SemiAuto
Tests
Run Manual
Tests @QUEENOFCODE
@QUEENOFCODE
EXAMPLE SUITE BREAKDOWN
@QUEENOFCODE
Validation
Regression
Smoke
• Security Analysis
• Performance
• Visual UI
• E2E / API Tests
• UI Tests (Cypress JS)
• Login Tests
• Health checks
• Connectivity
PAIR CODE
CHANGES
TO
APPROPRIA
TE TESTS!
@QUEENOFCODE
Groups of functionality should
have groups of tests
Microrepo? Put the tests with
their code!
Tag code packages with their
test packages
Use compilation to tell you what
tests apply to what code
INTEGRATION TEST MATRIX –
LOGIN SCENARIO
Frontend App
ASP
Frontend
JS FW
Web Server
Backend App
Auth Service
RESTful API
Cache Service
Data Layer
SQL DB
NoSQL DB
@QUEENOFCODE
INTEGRATION TEST MATRIX – API
SCENARIO
UI App
JS Framework
ASP Frontend
Web Server
Backend App
Auth Service
RESTful API
Cache Service
Data Layer
SQL DB
NoSQL DB
@QUEENOFCODE
EXERCISE: MAPPING CASES TO
CATEGORIZED SUITES
Photo
Gallery Site
UX FrontEnd
(HTML5 + JS)
Logic BackEnd
(Java)
Data Store
(NoSQL)
• What should we run?
• When should we run it?
• How long should we wait?
@QUEENOFCODE
KEY TAKEAWAYS
Run the tests
most relevant to
your changes
first
1
Having multiple
test suites is
cheap
2
Machine time is
MUCH cheaper
than human
time
3
Fail fast and fail
often
4
@QUEENOFCODE
Monitoring and Reporting
WHAT JUST HAPPENED?
CODE
HEALTH
@QUEENOFCODE
IF YOUR SITE CRASHES ON THE
INTERNET BUT ISN’T MONITORED,
IS IT REALLY DOWN???
@QUEENOFCODE
PILLARS OF OBSERVABILITY
Logging
•Detailed information
•Specific events
Metrics
•Systemic
informatio
n
•Events
over time
Tracing
•Systemic information
•Specific events
@QUEENOFCODE
LOGGING VS METRICS
Text Log File? Graph?
@QUEENOFCODE
METRIC TYPES
Rate
Success Requests Per
Second
Failure Requests Per
Second
Events Per Second
Percentile
Request Latency
Database
Latency
6
0
%
9
0
%
60 75 50
90
Numb
er
Max items in
queue
Bytes in use
2-Feb 3-Feb 4-Feb 5-Feb
Avg 90th 99th
@QUEENOFCODE
USING METRICS
@QUEENOFCODE
METRICS AND ALERTS
@QUEENOFCODE
METRICS AND AUTOMATION
Function Call Validate
A = 2
B = 5
Calls ==
11
5 == A
0 == B
12 == Calls
Create Input
void Call(ref int A, ref int B)
{
A = DoWork();
B = DoOtherWork();
CallsCounter.Increment();
}
@QUEENOFCODE
KEY TAKEAWAYS
Reliable, fast,
specific tests are
king
1
Know where your
cutline is and
respect your time
2
Don’t try to boil
the ocean – rely on
the backstop!
3
Automate what
you can and make
a plan for the rest
4
@QUEENOFCODE
Thank you!
GET IN TOUCH!
MELISSA BENUA
MBENUA@GMAIL.COM
TWITTER: @QUEENOFCODE
HTTPS://QUEENOFCODE.NET

Mais conteúdo relacionado

Semelhante a Test Design for Fully Automated Build Architectures

From 0 to DevOps in 80 Days [Webinar Replay]
From 0 to DevOps in 80 Days [Webinar Replay]From 0 to DevOps in 80 Days [Webinar Replay]
From 0 to DevOps in 80 Days [Webinar Replay]
Dynatrace
 
Continuous delivery @ hi q
Continuous delivery @ hi qContinuous delivery @ hi q
Continuous delivery @ hi q
Tomas Riha
 
Our DevOps Journey: 6 Month Waterfalls to 1 Hour Code Deploys
Our DevOps Journey: 6 Month Waterfalls to 1 Hour Code DeploysOur DevOps Journey: 6 Month Waterfalls to 1 Hour Code Deploys
Our DevOps Journey: 6 Month Waterfalls to 1 Hour Code Deploys
Dynatrace
 

Semelhante a Test Design for Fully Automated Build Architectures (20)

Patterns and practices for building enterprise-scale HTML5 apps
Patterns and practices for building enterprise-scale HTML5 appsPatterns and practices for building enterprise-scale HTML5 apps
Patterns and practices for building enterprise-scale HTML5 apps
 
Continuous Load Testing with CloudTest and Jenkins
Continuous Load Testing with CloudTest and JenkinsContinuous Load Testing with CloudTest and Jenkins
Continuous Load Testing with CloudTest and Jenkins
 
From 0 to DevOps in 80 Days [Webinar Replay]
From 0 to DevOps in 80 Days [Webinar Replay]From 0 to DevOps in 80 Days [Webinar Replay]
From 0 to DevOps in 80 Days [Webinar Replay]
 
Visual Studio 2015 - Lançamento está próximo
Visual Studio 2015 - Lançamento está próximoVisual Studio 2015 - Lançamento está próximo
Visual Studio 2015 - Lançamento está próximo
 
Chef Automate - Wellington DevOps August 2, 2017
Chef Automate - Wellington DevOps August 2, 2017Chef Automate - Wellington DevOps August 2, 2017
Chef Automate - Wellington DevOps August 2, 2017
 
Continuous delivery @ hi q
Continuous delivery @ hi qContinuous delivery @ hi q
Continuous delivery @ hi q
 
Testing for Logic App Solutions | Integration Monday
Testing for Logic App Solutions | Integration MondayTesting for Logic App Solutions | Integration Monday
Testing for Logic App Solutions | Integration Monday
 
Effective performance evaluation as part of a CI approach - Mission Impossible?
Effective performance evaluation as part of a CI approach - Mission Impossible?Effective performance evaluation as part of a CI approach - Mission Impossible?
Effective performance evaluation as part of a CI approach - Mission Impossible?
 
Transform Digital Business with DevOps
Transform Digital Business with DevOpsTransform Digital Business with DevOps
Transform Digital Business with DevOps
 
Udvid din test portefølje med coded ui test og cloud load test
Udvid din test portefølje med coded ui test og cloud load testUdvid din test portefølje med coded ui test og cloud load test
Udvid din test portefølje med coded ui test og cloud load test
 
CD
CDCD
CD
 
Continuous Delivery for Open Source Java projects
Continuous Delivery for Open Source Java projectsContinuous Delivery for Open Source Java projects
Continuous Delivery for Open Source Java projects
 
Continuous Deployment of your Application - SpringOne Tour Dallas
Continuous Deployment of your Application - SpringOne Tour DallasContinuous Deployment of your Application - SpringOne Tour Dallas
Continuous Deployment of your Application - SpringOne Tour Dallas
 
Our DevOps Journey: 6 Month Waterfalls to 1 Hour Code Deploys
Our DevOps Journey: 6 Month Waterfalls to 1 Hour Code DeploysOur DevOps Journey: 6 Month Waterfalls to 1 Hour Code Deploys
Our DevOps Journey: 6 Month Waterfalls to 1 Hour Code Deploys
 
Continuous Load Testing with CloudTest and Jenkins
Continuous Load Testing with CloudTest and JenkinsContinuous Load Testing with CloudTest and Jenkins
Continuous Load Testing with CloudTest and Jenkins
 
End-end tests as first class citizens - SeleniumConf 2020
End-end tests as first class citizens - SeleniumConf 2020End-end tests as first class citizens - SeleniumConf 2020
End-end tests as first class citizens - SeleniumConf 2020
 
Building and Managing Reliable Infrastructure with Chef and Chef Delivery
Building and Managing Reliable Infrastructure with Chef and Chef DeliveryBuilding and Managing Reliable Infrastructure with Chef and Chef Delivery
Building and Managing Reliable Infrastructure with Chef and Chef Delivery
 
Java Test Automation for REST, Web and Mobile
Java Test Automation for REST, Web and MobileJava Test Automation for REST, Web and Mobile
Java Test Automation for REST, Web and Mobile
 
How to Add Perfecto to Your CI
How to Add Perfecto to Your CIHow to Add Perfecto to Your CI
How to Add Perfecto to Your CI
 
Evolutionary infrastructure agile 2018 - kief morris
Evolutionary infrastructure   agile 2018 - kief morrisEvolutionary infrastructure   agile 2018 - kief morris
Evolutionary infrastructure agile 2018 - kief morris
 

Último

Digital Signal Processing Lecture notes n.pdf
Digital Signal Processing Lecture notes n.pdfDigital Signal Processing Lecture notes n.pdf
Digital Signal Processing Lecture notes n.pdf
AbrahamGadissa
 
Online blood donation management system project.pdf
Online blood donation management system project.pdfOnline blood donation management system project.pdf
Online blood donation management system project.pdf
Kamal Acharya
 
RS Khurmi Machine Design Clutch and Brake Exercise Numerical Solutions
RS Khurmi Machine Design Clutch and Brake Exercise Numerical SolutionsRS Khurmi Machine Design Clutch and Brake Exercise Numerical Solutions
RS Khurmi Machine Design Clutch and Brake Exercise Numerical Solutions
Atif Razi
 

Último (20)

retail automation billing system ppt.pptx
retail automation billing system ppt.pptxretail automation billing system ppt.pptx
retail automation billing system ppt.pptx
 
Introduction to Machine Learning Unit-4 Notes for II-II Mechanical Engineering
Introduction to Machine Learning Unit-4 Notes for II-II Mechanical EngineeringIntroduction to Machine Learning Unit-4 Notes for II-II Mechanical Engineering
Introduction to Machine Learning Unit-4 Notes for II-II Mechanical Engineering
 
Digital Signal Processing Lecture notes n.pdf
Digital Signal Processing Lecture notes n.pdfDigital Signal Processing Lecture notes n.pdf
Digital Signal Processing Lecture notes n.pdf
 
NO1 Pandit Black Magic Removal in Uk kala jadu Specialist kala jadu for Love ...
NO1 Pandit Black Magic Removal in Uk kala jadu Specialist kala jadu for Love ...NO1 Pandit Black Magic Removal in Uk kala jadu Specialist kala jadu for Love ...
NO1 Pandit Black Magic Removal in Uk kala jadu Specialist kala jadu for Love ...
 
Natalia Rutkowska - BIM School Course in Kraków
Natalia Rutkowska - BIM School Course in KrakówNatalia Rutkowska - BIM School Course in Kraków
Natalia Rutkowska - BIM School Course in Kraków
 
NO1 Pandit Amil Baba In Bahawalpur, Sargodha, Sialkot, Sheikhupura, Rahim Yar...
NO1 Pandit Amil Baba In Bahawalpur, Sargodha, Sialkot, Sheikhupura, Rahim Yar...NO1 Pandit Amil Baba In Bahawalpur, Sargodha, Sialkot, Sheikhupura, Rahim Yar...
NO1 Pandit Amil Baba In Bahawalpur, Sargodha, Sialkot, Sheikhupura, Rahim Yar...
 
Explosives Industry manufacturing process.pdf
Explosives Industry manufacturing process.pdfExplosives Industry manufacturing process.pdf
Explosives Industry manufacturing process.pdf
 
KIT-601 Lecture Notes-UNIT-4.pdf Frequent Itemsets and Clustering
KIT-601 Lecture Notes-UNIT-4.pdf Frequent Itemsets and ClusteringKIT-601 Lecture Notes-UNIT-4.pdf Frequent Itemsets and Clustering
KIT-601 Lecture Notes-UNIT-4.pdf Frequent Itemsets and Clustering
 
Introduction to Machine Learning Unit-5 Notes for II-II Mechanical Engineering
Introduction to Machine Learning Unit-5 Notes for II-II Mechanical EngineeringIntroduction to Machine Learning Unit-5 Notes for II-II Mechanical Engineering
Introduction to Machine Learning Unit-5 Notes for II-II Mechanical Engineering
 
A CASE STUDY ON ONLINE TICKET BOOKING SYSTEM PROJECT.pdf
A CASE STUDY ON ONLINE TICKET BOOKING SYSTEM PROJECT.pdfA CASE STUDY ON ONLINE TICKET BOOKING SYSTEM PROJECT.pdf
A CASE STUDY ON ONLINE TICKET BOOKING SYSTEM PROJECT.pdf
 
RESORT MANAGEMENT AND RESERVATION SYSTEM PROJECT REPORT.pdf
RESORT MANAGEMENT AND RESERVATION SYSTEM PROJECT REPORT.pdfRESORT MANAGEMENT AND RESERVATION SYSTEM PROJECT REPORT.pdf
RESORT MANAGEMENT AND RESERVATION SYSTEM PROJECT REPORT.pdf
 
Online blood donation management system project.pdf
Online blood donation management system project.pdfOnline blood donation management system project.pdf
Online blood donation management system project.pdf
 
Online resume builder management system project report.pdf
Online resume builder management system project report.pdfOnline resume builder management system project report.pdf
Online resume builder management system project report.pdf
 
Democratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek AryaDemocratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek Arya
 
BRAKING SYSTEM IN INDIAN RAILWAY AutoCAD DRAWING
BRAKING SYSTEM IN INDIAN RAILWAY AutoCAD DRAWINGBRAKING SYSTEM IN INDIAN RAILWAY AutoCAD DRAWING
BRAKING SYSTEM IN INDIAN RAILWAY AutoCAD DRAWING
 
Construction method of steel structure space frame .pptx
Construction method of steel structure space frame .pptxConstruction method of steel structure space frame .pptx
Construction method of steel structure space frame .pptx
 
Electrostatic field in a coaxial transmission line
Electrostatic field in a coaxial transmission lineElectrostatic field in a coaxial transmission line
Electrostatic field in a coaxial transmission line
 
Arduino based vehicle speed tracker project
Arduino based vehicle speed tracker projectArduino based vehicle speed tracker project
Arduino based vehicle speed tracker project
 
RS Khurmi Machine Design Clutch and Brake Exercise Numerical Solutions
RS Khurmi Machine Design Clutch and Brake Exercise Numerical SolutionsRS Khurmi Machine Design Clutch and Brake Exercise Numerical Solutions
RS Khurmi Machine Design Clutch and Brake Exercise Numerical Solutions
 
Halogenation process of chemical process industries
Halogenation process of chemical process industriesHalogenation process of chemical process industries
Halogenation process of chemical process industries
 

Test Design for Fully Automated Build Architectures

Notas do Editor

  1. Talk about Microsoft and Bing especially Key things to hit: * Worked with continuous builds in some form for my entire career Worked as an SDET, as a straight dev, and as a combined engineer Created this from scratch at PlayFab Talk about Microsoft and Bing especially Key things to hit: * Worked with continuous builds in some form for my entire career Worked as an SDET, as a straight dev, and as a combined engineer Created this from scratch at PlayFab
  2. This is an automated pipeline! Don’t get too in-depth, we will talk more Talk notes: * Please speak up if there’s a question Feel free to ask questions at any time, or for examples or to deep-dive * Ask about experience in the room – who is working greenfield? Updating an old existing code base? Working in an existing CI/CD pipeline? What we are going to talk about: What makes a good test case, when we want to run those test cases, and then how we monitor and report on those test cases
  3. These are my guiding principles of test design – ESPECIALLY KEY when things are fully-automated
  4. * Don’t bog down on what these mean, but give a high-level overview
  5. In a perfect world, we would always run every test In a perfect world, every test would be super fast and we would also have infinite time Battlefield triage is key!
  6. If you had time to only debug one of these two issues, which would you do? The ‘time game’ is a fun way to figure out what tests really matter
  7. Squeaky tests only train people to ignore test failures – and then they WILL ignore a real failure and it will go to prod by accident – ask me how I know! Try – finally blocks are amazing – no catches required! Any test that touches the file system or DB system must do that. Obviously – a test can’t be automated if it requires someone to manually purge the DB after it runs
  8. Sometimes tools can help you find flaky tests
  9. Be ruthless with cutting out overlapping coverage – read your code coverage reports and slash away! Can be nerve-wracking to delete tests Very tempting to roll lots of things into a single test case to save time, but this makes debugging a nightmare
  10. * Watch out for global static variables. Watch out even more for a shared test database NEVER (almost never) write a test that relies on Thread.Sleep. Timing issues are horrible to debug! Can you make it synchronous? A callback?? Caching and shared resources can introduce the weirdest and hardest to debug test failures. Time-killers! Spend time to work around them beforehand instead of spending time debugging the failure (and then having to work around them anyways) * Talk about the angst from the shared test Dynamo at Playfab and the days spent figuring out what happened and how to stop it
  11. The goal is to come up with lots and lots of test cases, which we will later be organizing into test suites DO NOT get into putting them into suites DO NOT throw away tests
  12. This is an automated pipeline! Don’t get too in-depth, we will talk more Talk notes: * Please speak up if there’s a question Feel free to ask questions at any time, or for examples or to deep-dive * Ask about experience in the room – who is working greenfield? Updating an old existing code base? Working in an existing CI/CD pipeline? What we are going to talk about: What makes a good test case, when we want to run those test cases, and then how we monitor and report on those test cases
  13. Unit tests may cross functional boundaries, in that they may test more than one ‘function’. But they shouldn’t test an app.
  14. * Simplest structure means running one build, one set of tests, and calling it done. Few projects can be that simple! Tests grow with scale! Breaking up a code base is half art and half science. (those are the bullet points) Ideally every test would run all the time, but almost nobody has time for that. Test what you can, and know what risk you are swallowing for later Make sure each stage fails quickly if it’s going to fail. Do NOT propagate failures down the pipe.
  15. ‘Integration’ test here is category. A number of test suites can fall into this category – your smoke test suite, for example.
  16. Speciality is anything that can’t be run automatically and quickly. Maybe it requires manual setup, or maybe it’s difficult to have a machine to validate. Maybe it just takes a MILLION years to run. Maybe it is unreliable.
  17. This is the sample architecture of a fictional service – say, something like that image hosting site from our last example. We’ll use this architecture as a guide for the talking about what tests to write and when to run them.
  18. Remember – if you’re going to have manual steps, it’s in step 4.
  19. This is a sequence diagram that describes the lifecycle of a single change. The tester is actually in control here – we are conditionally running different tests suites depending on their judgement of the change
  20. Validation pass includes semi-automated tests
  21. Many more potential test suites in these categories.
  22. * let’s use all the tests that we came up with before, and now let’s prioritize and move them into test suites. * Let’s give each test suite a maximum wait time before a failure is cheaper than waiting for it to pass.
  23. This graph is not scientific! In my experience, the sweet spot is somewhere between 70 and 80% code coverage. Any more than that is a whole lot of time for not much return. Line coverage just means a line was run,. Branch coverage includes proper handling of ifs and switches. It’s generally more diagnostic. Lets you know what needs to be tested more – a 5% covered package versus a 50% covered package Quanitify the output of your test efforts over time to management! They eat this stuff up (HA HA HA)
  24. Which of these would you rather debug?