SlideShare una empresa de Scribd logo
1 de 26
Descargar para leer sin conexión
Testing without
waste
Automatic testing
Kimmo Brunfeldt 02/2016
@kimmobrunfeldt
// WHY AUTOMATE?
WHY
- Enables fast movement
- Catch embarrassing
regression bugs
- Refactor with confidence
- Provides examples of
how to use your code
REALITY
- Budgets are tight
- There's no time
- "Do we need tests?"
- Tests are not a priority
- Writing tests = no value
for customer now
(yes)
// MY RULES OF THUMB
Test against the most stable API
Tests should help
refactoring
REFACTORING
- You are able to ship features faster,
without worrying about breaking previous
ones
- Goal: even you refactor most internals of
your app, you shouldn't have to change
test code
- Do NOT tie your tests too much to internal
knowledge. As an example, HTTP API is
most likely the least changing API
- If you find yourself maintaining tests every
time you change code, that's wrong!
Even if you don't test every case now,
you should setup tests so that writing
cases is easy in the future.
Don't leave test
setup for later
NO
YES
https://medium.com/@kimmobrunfeldt/the-real-benefit-of-tdd-d2fdc9fc4ddf
It means extra maintenance because you
"fake" another API
* Unless that's really, REALLY the only
viable option. Are you sure it is?
Don't fake
anything*
NO FAKING
- Do real HTTP requests against your
backend. Setup the server running locally
and test that.
- Have a real Postgres with test database,
have a real S3 test bucket etc.
- Try to replicate the real scenario as close
as possible
- You don't want to maintain compability to
any external API. You already have to
maintain the compability with your own
app's API - That is enough work and
trouble
I have found them to be the good in
practice.
Focus to
integration tests
INTEGRATION
- Integration tests usually don't know that
much about app internals so they are easy
to maintain even your internals change. I
have done very big refactors with
confidence thanks to integration tests
- They may take longer to run, but ... usually
they are still more pragmatic than e.g. unit
tests
It will reveal bugs like missing
dependencies in app configuration.
Have a CI server
also run tests
CONTINUOUS
INTEGRATION
- Good to run tests in a different
environment than yours
- It will do a "fresh install", which might
reveal some details
- Travis CI and Circle CI are good tools
You know they'll help you later. They will
save your ass when you need to suddenly
refactor a lot to do a new feature.
No excuses,
take this medicine
NO EXCUSES
- Quite a lot of people I've spoken with,
knows the value of testing, but just
somehow they convince themselves not to
write them
- Initial setup takes time, but it will save time
later - trust yourself.
- If you have bad experience of maintaining
tens of breaking tests, try to test from
higher layer to minimize maintenance
// APPLY THESE TIPS
FRAMEWORK
INTERNALS
HTTP LAYER
CORE LOGIC
DATABASE
- Unwraps HTTP request
- Does basic validation. "Does it look
correct"
- Doesn’t know HTTP, simple input and
output
- Handles database transactions
- Minimal input parameters and outputs raw
data structures. Does not reveal storage
details to caller.
- Minimize the dependency to a
specific database if possible
SPLIT
RESPONSIBILITIES
FRAMEWORK
INTERNALS
HTTP LAYER
CORE LOGIC
DATABASE
WHAT TO TEST?
Need to mock
HTTP request
in tests, so
don't
Easy to test.
You need db,
but no
mocking,
great .. BUT
?WHAT TO TEST?
FRAMEWORK
INTERNALS
HTTP LAYER
CORE LOGIC
DATABASE
The most maintainable
tests know nothing
about your application
layers.
?TEST THIS
INPUT X
OUTPUT Y
Was the output
correct?
?IN PRACTICE
GET /posts/1
Was the title and
content correct?
{
"title": "First",
"content": "..."
}
IF YOU NEED MORE
FRAMEWORK
INTERNALS
HTTP LAYER
CORE LOGIC
DATABASE
If you have e.g. bank transactions in your
business logic, definitely test them. The good
layer would be "core logic" = business logic
layer. Even though they will tie the tests to
internal knowledge
// I HAVE SOME BLOG POSTS
https://medium.com/@kimmobrunfeldt/the-real-benefit-of-tdd-d2fdc9fc4ddf#.o62kgijna
https://medium.com/@kimmobrunfeldt/testing-for-startups-10732eb253e8#.o9jy8igti
https://medium.com/@kimmobrunfeldt/introduction-to-sauce-labs-3ad082fc7dd5#.u041fufej
// THANKS
✅ ➡ 😎

Más contenido relacionado

La actualidad más candente

Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven DevelopmentZendCon
 
The What, Why and How of Analytics Testing
The What, Why and How of Analytics TestingThe What, Why and How of Analytics Testing
The What, Why and How of Analytics TestingAnand Bagmar
 
Patterns in Test Automation
Patterns in Test AutomationPatterns in Test Automation
Patterns in Test AutomationAnand Bagmar
 
Continuous performance: Load testing for developers with gatling
Continuous performance: Load testing for developers with gatlingContinuous performance: Load testing for developers with gatling
Continuous performance: Load testing for developers with gatlingTim van Eijndhoven
 
Getting Started With Cypress
Getting Started With CypressGetting Started With Cypress
Getting Started With CypressKnoldus Inc.
 
Test Data - Food for your Test Automation Framework
Test Data - Food for your Test Automation FrameworkTest Data - Food for your Test Automation Framework
Test Data - Food for your Test Automation FrameworkAnand Bagmar
 
Perils of Page-Object Pattern
Perils of Page-Object PatternPerils of Page-Object Pattern
Perils of Page-Object PatternAnand Bagmar
 
I Don't Test Often ...
I Don't Test Often ...I Don't Test Often ...
I Don't Test Often ...Gareth Bowles
 
Boston MeetUp 10.10
Boston MeetUp 10.10Boston MeetUp 10.10
Boston MeetUp 10.10Solano Labs
 
What is Agile Testing? How does Automation help?
What is Agile Testing? How does Automation help?What is Agile Testing? How does Automation help?
What is Agile Testing? How does Automation help?Anand Bagmar
 
Patterns of a “good” test automation framework
Patterns of a “good” test automation frameworkPatterns of a “good” test automation framework
Patterns of a “good” test automation frameworkAnand Bagmar
 
Lets cook cucumber !!
Lets cook cucumber !!Lets cook cucumber !!
Lets cook cucumber !!vodQA
 
Enterprise Workflows When You Aren't Enterprise
Enterprise Workflows When You Aren't EnterpriseEnterprise Workflows When You Aren't Enterprise
Enterprise Workflows When You Aren't EnterpriseChris Tankersley
 
How To Combine Back-End 
 & Front-End Testing with BlazeMeter & Sauce Labs
How To Combine Back-End 
 & Front-End Testing with BlazeMeter & Sauce LabsHow To Combine Back-End 
 & Front-End Testing with BlazeMeter & Sauce Labs
How To Combine Back-End 
 & Front-End Testing with BlazeMeter & Sauce LabsSauce Labs
 
Impact Analysis - LoopConf
Impact Analysis - LoopConfImpact Analysis - LoopConf
Impact Analysis - LoopConfChris Lema
 
Sync Workitems between multiple Team Projects #vssatpn
Sync Workitems between multiple Team Projects #vssatpnSync Workitems between multiple Team Projects #vssatpn
Sync Workitems between multiple Team Projects #vssatpnLorenzo Barbieri
 
STAQ Development Manual (Redacted)
STAQ Development Manual (Redacted)STAQ Development Manual (Redacted)
STAQ Development Manual (Redacted)Mike Subelsky
 

La actualidad más candente (20)

Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
The What, Why and How of Analytics Testing
The What, Why and How of Analytics TestingThe What, Why and How of Analytics Testing
The What, Why and How of Analytics Testing
 
Patterns in Test Automation
Patterns in Test AutomationPatterns in Test Automation
Patterns in Test Automation
 
Continuous performance: Load testing for developers with gatling
Continuous performance: Load testing for developers with gatlingContinuous performance: Load testing for developers with gatling
Continuous performance: Load testing for developers with gatling
 
Getting Started With Cypress
Getting Started With CypressGetting Started With Cypress
Getting Started With Cypress
 
Test Data - Food for your Test Automation Framework
Test Data - Food for your Test Automation FrameworkTest Data - Food for your Test Automation Framework
Test Data - Food for your Test Automation Framework
 
Perils of Page-Object Pattern
Perils of Page-Object PatternPerils of Page-Object Pattern
Perils of Page-Object Pattern
 
I Don't Test Often ...
I Don't Test Often ...I Don't Test Often ...
I Don't Test Often ...
 
Boston MeetUp 10.10
Boston MeetUp 10.10Boston MeetUp 10.10
Boston MeetUp 10.10
 
What is Agile Testing? How does Automation help?
What is Agile Testing? How does Automation help?What is Agile Testing? How does Automation help?
What is Agile Testing? How does Automation help?
 
Patterns of a “good” test automation framework
Patterns of a “good” test automation frameworkPatterns of a “good” test automation framework
Patterns of a “good” test automation framework
 
Drupal 7 ci and testing
Drupal 7 ci and testingDrupal 7 ci and testing
Drupal 7 ci and testing
 
Lets cook cucumber !!
Lets cook cucumber !!Lets cook cucumber !!
Lets cook cucumber !!
 
Enterprise Workflows When You Aren't Enterprise
Enterprise Workflows When You Aren't EnterpriseEnterprise Workflows When You Aren't Enterprise
Enterprise Workflows When You Aren't Enterprise
 
How To Combine Back-End 
 & Front-End Testing with BlazeMeter & Sauce Labs
How To Combine Back-End 
 & Front-End Testing with BlazeMeter & Sauce LabsHow To Combine Back-End 
 & Front-End Testing with BlazeMeter & Sauce Labs
How To Combine Back-End 
 & Front-End Testing with BlazeMeter & Sauce Labs
 
Impact Analysis - LoopConf
Impact Analysis - LoopConfImpact Analysis - LoopConf
Impact Analysis - LoopConf
 
Cypress testing
Cypress testingCypress testing
Cypress testing
 
Increase automation to rest
Increase automation to restIncrease automation to rest
Increase automation to rest
 
Sync Workitems between multiple Team Projects #vssatpn
Sync Workitems between multiple Team Projects #vssatpnSync Workitems between multiple Team Projects #vssatpn
Sync Workitems between multiple Team Projects #vssatpn
 
STAQ Development Manual (Redacted)
STAQ Development Manual (Redacted)STAQ Development Manual (Redacted)
STAQ Development Manual (Redacted)
 

Destacado

Project thinking and digital service business
Project thinking and digital service businessProject thinking and digital service business
Project thinking and digital service businessFuturice
 
Markus Paasovaara: Face recognition
Markus Paasovaara: Face recognitionMarkus Paasovaara: Face recognition
Markus Paasovaara: Face recognitionFuturice
 
Agile Software Security
Agile Software SecurityAgile Software Security
Agile Software SecurityFuturice
 
Reark : a Reference Architecture for Android using RxJava
Reark : a Reference Architecture for Android using RxJavaReark : a Reference Architecture for Android using RxJava
Reark : a Reference Architecture for Android using RxJavaFuturice
 
Pepperoni – A framework for spicing up your mobile apps with React Native
Pepperoni – A framework for spicing up your mobile apps with React NativePepperoni – A framework for spicing up your mobile apps with React Native
Pepperoni – A framework for spicing up your mobile apps with React NativeFuturice
 
Fantastic Problems and Where to Find Them: Daryl Weir
Fantastic Problems and Where to Find Them: Daryl WeirFantastic Problems and Where to Find Them: Daryl Weir
Fantastic Problems and Where to Find Them: Daryl WeirFuturice
 

Destacado (6)

Project thinking and digital service business
Project thinking and digital service businessProject thinking and digital service business
Project thinking and digital service business
 
Markus Paasovaara: Face recognition
Markus Paasovaara: Face recognitionMarkus Paasovaara: Face recognition
Markus Paasovaara: Face recognition
 
Agile Software Security
Agile Software SecurityAgile Software Security
Agile Software Security
 
Reark : a Reference Architecture for Android using RxJava
Reark : a Reference Architecture for Android using RxJavaReark : a Reference Architecture for Android using RxJava
Reark : a Reference Architecture for Android using RxJava
 
Pepperoni – A framework for spicing up your mobile apps with React Native
Pepperoni – A framework for spicing up your mobile apps with React NativePepperoni – A framework for spicing up your mobile apps with React Native
Pepperoni – A framework for spicing up your mobile apps with React Native
 
Fantastic Problems and Where to Find Them: Daryl Weir
Fantastic Problems and Where to Find Them: Daryl WeirFantastic Problems and Where to Find Them: Daryl Weir
Fantastic Problems and Where to Find Them: Daryl Weir
 

Similar a Testing Without Waste - Automatic Testing

How selenium can transform your qa career
How selenium can transform your qa careerHow selenium can transform your qa career
How selenium can transform your qa careerShama Ugale
 
Developers’ mDay u Banjoj Luci - Milan Popović, PHP Srbija – Testimony (about...
Developers’ mDay u Banjoj Luci - Milan Popović, PHP Srbija – Testimony (about...Developers’ mDay u Banjoj Luci - Milan Popović, PHP Srbija – Testimony (about...
Developers’ mDay u Banjoj Luci - Milan Popović, PHP Srbija – Testimony (about...mCloud
 
How to scale your Test Automation
How to scale your Test AutomationHow to scale your Test Automation
How to scale your Test AutomationKlaus Salchner
 
Writing useful automated tests for the single page applications you build
Writing useful automated tests for the single page applications you buildWriting useful automated tests for the single page applications you build
Writing useful automated tests for the single page applications you buildAndrei Sebastian Cîmpean
 
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 FearTechWell
 
assertYourself - Breaking the Theories and Assumptions of Unit Testing in Flex
assertYourself - Breaking the Theories and Assumptions of Unit Testing in FlexassertYourself - Breaking the Theories and Assumptions of Unit Testing in Flex
assertYourself - Breaking the Theories and Assumptions of Unit Testing in Flexmichael.labriola
 
Testing Hourglass at Jira Frontend - by Alexey Shpakov, Sr. Developer @ Atlas...
Testing Hourglass at Jira Frontend - by Alexey Shpakov, Sr. Developer @ Atlas...Testing Hourglass at Jira Frontend - by Alexey Shpakov, Sr. Developer @ Atlas...
Testing Hourglass at Jira Frontend - by Alexey Shpakov, Sr. Developer @ Atlas...Applitools
 
Solano Labs presented at MassTLC's automated testing
Solano Labs presented at MassTLC's automated testingSolano Labs presented at MassTLC's automated testing
Solano Labs presented at MassTLC's automated testingMassTLC
 
Software Testing, Everyone's responsibility
Software Testing, Everyone's responsibilitySoftware Testing, Everyone's responsibility
Software Testing, Everyone's responsibilityKurt Bliefernich
 
Topic production code
Topic production codeTopic production code
Topic production codeKavi Kumar
 
Use Automation to Assist—Not Replace—Manual Testing
Use Automation to Assist—Not Replace—Manual TestingUse Automation to Assist—Not Replace—Manual Testing
Use Automation to Assist—Not Replace—Manual TestingTechWell
 
Creating testing tools to support development
Creating testing tools to support developmentCreating testing tools to support development
Creating testing tools to support developmentChema del Barco
 
Michigan IT Symposium 2017 - CI/CD Workflow Tutorial
Michigan IT Symposium 2017 - CI/CD Workflow TutorialMichigan IT Symposium 2017 - CI/CD Workflow Tutorial
Michigan IT Symposium 2017 - CI/CD Workflow TutorialJeffrey Sica
 
[DPE Summit] How Improving the Testing Experience Goes Beyond Quality: A Deve...
[DPE Summit] How Improving the Testing Experience Goes Beyond Quality: A Deve...[DPE Summit] How Improving the Testing Experience Goes Beyond Quality: A Deve...
[DPE Summit] How Improving the Testing Experience Goes Beyond Quality: A Deve...Roberto Pérez Alcolea
 
Don't hate, automate. lessons learned from implementing continuous delivery
Don't hate, automate. lessons learned from implementing continuous deliveryDon't hate, automate. lessons learned from implementing continuous delivery
Don't hate, automate. lessons learned from implementing continuous deliverySolano Labs
 
Neotys PAC - Stijn Schepers
Neotys PAC - Stijn SchepersNeotys PAC - Stijn Schepers
Neotys PAC - Stijn SchepersNeotys_Partner
 

Similar a Testing Without Waste - Automatic Testing (20)

How selenium can transform your qa career
How selenium can transform your qa careerHow selenium can transform your qa career
How selenium can transform your qa career
 
Developers’ mDay u Banjoj Luci - Milan Popović, PHP Srbija – Testimony (about...
Developers’ mDay u Banjoj Luci - Milan Popović, PHP Srbija – Testimony (about...Developers’ mDay u Banjoj Luci - Milan Popović, PHP Srbija – Testimony (about...
Developers’ mDay u Banjoj Luci - Milan Popović, PHP Srbija – Testimony (about...
 
How to scale your Test Automation
How to scale your Test AutomationHow to scale your Test Automation
How to scale your Test Automation
 
Writing useful automated tests for the single page applications you build
Writing useful automated tests for the single page applications you buildWriting useful automated tests for the single page applications you build
Writing useful automated tests for the single page applications you build
 
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
 
NYC MeetUp 10.9
NYC MeetUp 10.9NYC MeetUp 10.9
NYC MeetUp 10.9
 
assertYourself - Breaking the Theories and Assumptions of Unit Testing in Flex
assertYourself - Breaking the Theories and Assumptions of Unit Testing in FlexassertYourself - Breaking the Theories and Assumptions of Unit Testing in Flex
assertYourself - Breaking the Theories and Assumptions of Unit Testing in Flex
 
utplsql.pdf
utplsql.pdfutplsql.pdf
utplsql.pdf
 
Testing Hourglass at Jira Frontend - by Alexey Shpakov, Sr. Developer @ Atlas...
Testing Hourglass at Jira Frontend - by Alexey Shpakov, Sr. Developer @ Atlas...Testing Hourglass at Jira Frontend - by Alexey Shpakov, Sr. Developer @ Atlas...
Testing Hourglass at Jira Frontend - by Alexey Shpakov, Sr. Developer @ Atlas...
 
Solano Labs presented at MassTLC's automated testing
Solano Labs presented at MassTLC's automated testingSolano Labs presented at MassTLC's automated testing
Solano Labs presented at MassTLC's automated testing
 
Software Testing, Everyone's responsibility
Software Testing, Everyone's responsibilitySoftware Testing, Everyone's responsibility
Software Testing, Everyone's responsibility
 
Topic production code
Topic production codeTopic production code
Topic production code
 
Testing
TestingTesting
Testing
 
Use Automation to Assist—Not Replace—Manual Testing
Use Automation to Assist—Not Replace—Manual TestingUse Automation to Assist—Not Replace—Manual Testing
Use Automation to Assist—Not Replace—Manual Testing
 
Creating testing tools to support development
Creating testing tools to support developmentCreating testing tools to support development
Creating testing tools to support development
 
Michigan IT Symposium 2017 - CI/CD Workflow Tutorial
Michigan IT Symposium 2017 - CI/CD Workflow TutorialMichigan IT Symposium 2017 - CI/CD Workflow Tutorial
Michigan IT Symposium 2017 - CI/CD Workflow Tutorial
 
[DPE Summit] How Improving the Testing Experience Goes Beyond Quality: A Deve...
[DPE Summit] How Improving the Testing Experience Goes Beyond Quality: A Deve...[DPE Summit] How Improving the Testing Experience Goes Beyond Quality: A Deve...
[DPE Summit] How Improving the Testing Experience Goes Beyond Quality: A Deve...
 
Don't hate, automate. lessons learned from implementing continuous delivery
Don't hate, automate. lessons learned from implementing continuous deliveryDon't hate, automate. lessons learned from implementing continuous delivery
Don't hate, automate. lessons learned from implementing continuous delivery
 
Neotys PAC - Stijn Schepers
Neotys PAC - Stijn SchepersNeotys PAC - Stijn Schepers
Neotys PAC - Stijn Schepers
 
Future of QA
Future of QAFuture of QA
Future of QA
 

Último

A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 

Último (20)

A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 

Testing Without Waste - Automatic Testing

  • 1. Testing without waste Automatic testing Kimmo Brunfeldt 02/2016 @kimmobrunfeldt
  • 3. WHY - Enables fast movement - Catch embarrassing regression bugs - Refactor with confidence - Provides examples of how to use your code
  • 4. REALITY - Budgets are tight - There's no time - "Do we need tests?" - Tests are not a priority - Writing tests = no value for customer now (yes)
  • 5. // MY RULES OF THUMB
  • 6. Test against the most stable API Tests should help refactoring
  • 7. REFACTORING - You are able to ship features faster, without worrying about breaking previous ones - Goal: even you refactor most internals of your app, you shouldn't have to change test code - Do NOT tie your tests too much to internal knowledge. As an example, HTTP API is most likely the least changing API - If you find yourself maintaining tests every time you change code, that's wrong!
  • 8. Even if you don't test every case now, you should setup tests so that writing cases is easy in the future. Don't leave test setup for later
  • 10. It means extra maintenance because you "fake" another API * Unless that's really, REALLY the only viable option. Are you sure it is? Don't fake anything*
  • 11. NO FAKING - Do real HTTP requests against your backend. Setup the server running locally and test that. - Have a real Postgres with test database, have a real S3 test bucket etc. - Try to replicate the real scenario as close as possible - You don't want to maintain compability to any external API. You already have to maintain the compability with your own app's API - That is enough work and trouble
  • 12. I have found them to be the good in practice. Focus to integration tests
  • 13. INTEGRATION - Integration tests usually don't know that much about app internals so they are easy to maintain even your internals change. I have done very big refactors with confidence thanks to integration tests - They may take longer to run, but ... usually they are still more pragmatic than e.g. unit tests
  • 14. It will reveal bugs like missing dependencies in app configuration. Have a CI server also run tests
  • 15. CONTINUOUS INTEGRATION - Good to run tests in a different environment than yours - It will do a "fresh install", which might reveal some details - Travis CI and Circle CI are good tools
  • 16. You know they'll help you later. They will save your ass when you need to suddenly refactor a lot to do a new feature. No excuses, take this medicine
  • 17. NO EXCUSES - Quite a lot of people I've spoken with, knows the value of testing, but just somehow they convince themselves not to write them - Initial setup takes time, but it will save time later - trust yourself. - If you have bad experience of maintaining tens of breaking tests, try to test from higher layer to minimize maintenance
  • 19. FRAMEWORK INTERNALS HTTP LAYER CORE LOGIC DATABASE - Unwraps HTTP request - Does basic validation. "Does it look correct" - Doesn’t know HTTP, simple input and output - Handles database transactions - Minimal input parameters and outputs raw data structures. Does not reveal storage details to caller. - Minimize the dependency to a specific database if possible SPLIT RESPONSIBILITIES
  • 20. FRAMEWORK INTERNALS HTTP LAYER CORE LOGIC DATABASE WHAT TO TEST? Need to mock HTTP request in tests, so don't Easy to test. You need db, but no mocking, great .. BUT
  • 21. ?WHAT TO TEST? FRAMEWORK INTERNALS HTTP LAYER CORE LOGIC DATABASE The most maintainable tests know nothing about your application layers.
  • 22. ?TEST THIS INPUT X OUTPUT Y Was the output correct?
  • 23. ?IN PRACTICE GET /posts/1 Was the title and content correct? { "title": "First", "content": "..." }
  • 24. IF YOU NEED MORE FRAMEWORK INTERNALS HTTP LAYER CORE LOGIC DATABASE If you have e.g. bank transactions in your business logic, definitely test them. The good layer would be "core logic" = business logic layer. Even though they will tie the tests to internal knowledge
  • 25. // I HAVE SOME BLOG POSTS https://medium.com/@kimmobrunfeldt/the-real-benefit-of-tdd-d2fdc9fc4ddf#.o62kgijna https://medium.com/@kimmobrunfeldt/testing-for-startups-10732eb253e8#.o9jy8igti https://medium.com/@kimmobrunfeldt/introduction-to-sauce-labs-3ad082fc7dd5#.u041fufej