SlideShare ist ein Scribd-Unternehmen logo
1 von 34
Downloaden Sie, um offline zu lesen
How to push a ReactJS
application in production
and sleep better
Emanuele Rampichini Application Engineer @spreaker
So, you are
building a
large
ReactJS
single page
application...
2
● Do you need it?
● Are you sure?
● 100% Sure?
● I’m gonna ask it again...
● ARE YOU SURE?
SINGLE PAGE
APPLICATIONS ARE
COMPLEX
3
PnP® APPROACH
4
TESTING AND
MONITORING TO THE
RESCUE
5
Monitor your
ReactJS
application
in production
Monitoring your application in
production is crucial even if you don’t
write tests. The good news is that
nowadays is quite easy
6
● https://sentry.io
● https://newrelic.com
● https://trackjs.com
WHAT ABOUT
TESTING?
8
Let’s start by
defining
some testing
concepts...
Test families ordered from the
cheapest to the most expensive one.
Cost is a mix of write difficulty,
execution time, and maintenance
effort requested.
9
● Unit Tests
● Integration Tests (or midway)
● End 2 End Tests
● Manual Tests
LET’S SEE HOW TO FIT
THIS INSIDE A
REACT + REDUX APP
Useful tools
to do unit
testing in
ReactJs
11
● https://karma-runner.github.io/1
.0/index.html
● http://jasmine.github.io/
● http://phantomjs.org/
● Look for Karma + Webpack +
PhantomJS on google and you
are gonna find a lot of tutorials to
create your setup.
Unit testing a
reducer
function is a
piece of
cake... really!
We are just testing pure functions
(without side effects) in the form:
(State, Action) => State
These tests are very good to ensure
correctness of your state mutation
logic.
12
Unit testing
components
rendering
Given some props we want to ensure
the correctness of the rendered
output.
15
● https://facebook.github.io/react
/docs/test-utils.html
● Shallow Renderer
● https://github.com/sheepsteak
/react-shallow-testutils
● https://github.com/airbnb/enzy
me
Unit testing
components
behaviour
We want to ensure that when
something happens on our
component (lifecycle callbacks, clicks
etc...) the right action get dispatched
to our store.
21
● http://jasmine.github.io/2.0/intr
oduction.html#section-Spies
● Lifecycle: getMountedInstance()
● UI interaction: getOutput()
Unit testing
middlewares
and rich
actions
(thunk)
We want to ensure that a rich action
dispatches the right simple actions
in the right order to our store when
some preconditions are met.
24
● https://github.com/arnaudbenar
d/redux-mock-store
● http://jasmine.github.io/2.0/intr
oduction.html#section-Spies
Midway
testing
We want to test components only
mocking things at the lower level in
our architecture (ex. xhr request).
Every other piece is gonna be the
real application code.
27
● https://github.com/jasmine/jas
mine-ajax
● Setup can be tricky, ensures that
all the pieces are working well
together.
End 2 End
testing with
protractor
In that case we want to interact
directly with our application, we
ignore completely the fact that we
are testing a reactJS app. These tests
are quite slow to run, hard to
maintain and they require full control
of your backend data.
28
● http://www.protractortest.org/
● Expected Conditions
● browser.ignoreSynchronization=true
Manual
testing on
multiple
devices
These test are the most expensive
ones, still they are crucial. Be sure to
have as many real devices as you
can. Here are some tips:
29
● Build your own device wall
● Have a staging environment that
maps 1:1 the production one and
do internal testing.
● Adopt canary deployment
strategies
IT’S NOT HUGE BUT WE
BUILT IT...
30
A LOT OF TESTS TO
WRITE AND TO
MAINTAIN… NOT A LOT
OF TIME 31
▫ It’s OK not to test everything
▫ At first you are gonna be super
slow, then you are gonna
improve. Training is crucial.
▫ If you don’t have time to
implement tests just take some
to write test definitions and
mark them as skipped. You can
add coverage when you have
slack time. (xdescribe, xit )
P.S. WE ARE HIRING,
IF YOU ARE INTERESTED
OR YOU JUST WANT A
T-SHIRT JUST PING ME
Thanks. EMANUELE RAMPICHINI
APPLICATION ENGINEER @spreaker
Get It Touch
emanuele.rampichini@spreaker.com
@emanuele_r

Weitere ähnliche Inhalte

Was ist angesagt?

QA Strategies for Testing Legacy Web Apps
QA Strategies for Testing Legacy Web AppsQA Strategies for Testing Legacy Web Apps
QA Strategies for Testing Legacy Web AppsRainforest QA
 
(Js) Export your own WebGL Viewer
(Js) Export your own WebGL Viewer(Js) Export your own WebGL Viewer
(Js) Export your own WebGL ViewerJooinK
 
Automated tests types on Magento 2 example
Automated tests types on Magento 2 exampleAutomated tests types on Magento 2 example
Automated tests types on Magento 2 exampleSergii Ivashchenko
 
Mastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium SuccessfullyMastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium SuccessfullySpringPeople
 
Continuous integration CloudParty 21 may 2014 - Milan
Continuous integration CloudParty 21 may 2014 - MilanContinuous integration CloudParty 21 may 2014 - Milan
Continuous integration CloudParty 21 may 2014 - MilanSimone Pasquini
 
Unit Testing your React / Redux app (@BucharestJS)
Unit Testing your React / Redux app (@BucharestJS)Unit Testing your React / Redux app (@BucharestJS)
Unit Testing your React / Redux app (@BucharestJS)Alin Pandichi
 
Continuous Integration
Continuous IntegrationContinuous Integration
Continuous IntegrationJoseph Wang
 
Dicoding Developer Coaching #13: Android | Melakukan Testing secara Otomatis ...
Dicoding Developer Coaching #13: Android | Melakukan Testing secara Otomatis ...Dicoding Developer Coaching #13: Android | Melakukan Testing secara Otomatis ...
Dicoding Developer Coaching #13: Android | Melakukan Testing secara Otomatis ...DicodingEvent
 
Migration from AngularJS to Angular
Migration from AngularJS to AngularMigration from AngularJS to Angular
Migration from AngularJS to AngularAleks Zinevych
 
Test Automation Pyramid
Test Automation PyramidTest Automation Pyramid
Test Automation PyramidvodQA
 
Игорь Бондаренко (Neklo) - Организация процесса разработки модулей для Magento
Игорь Бондаренко (Neklo) - Организация процесса разработки модулей для MagentoИгорь Бондаренко (Neklo) - Организация процесса разработки модулей для Magento
Игорь Бондаренко (Neklo) - Организация процесса разработки модулей для Magentomeet_magento
 
Put "fast" back in "fast feedback"
Put "fast" back in "fast feedback"Put "fast" back in "fast feedback"
Put "fast" back in "fast feedback"Lars Thorup
 
Integration Testing in Enterprises using TaaS
Integration Testing in Enterprises using TaaSIntegration Testing in Enterprises using TaaS
Integration Testing in Enterprises using TaaSAnand Bagmar
 
How to go about testing in React?
How to go about testing in React? How to go about testing in React?
How to go about testing in React? Lisa Gagarina
 
TestWorks Conf Performance testing made easy with gatling - Guillaume Corré
TestWorks Conf Performance testing made easy with gatling - Guillaume CorréTestWorks Conf Performance testing made easy with gatling - Guillaume Corré
TestWorks Conf Performance testing made easy with gatling - Guillaume CorréXebia Nederland BV
 

Was ist angesagt? (19)

Protractor
Protractor Protractor
Protractor
 
QA Strategies for Testing Legacy Web Apps
QA Strategies for Testing Legacy Web AppsQA Strategies for Testing Legacy Web Apps
QA Strategies for Testing Legacy Web Apps
 
(Js) Export your own WebGL Viewer
(Js) Export your own WebGL Viewer(Js) Export your own WebGL Viewer
(Js) Export your own WebGL Viewer
 
Automated tests types on Magento 2 example
Automated tests types on Magento 2 exampleAutomated tests types on Magento 2 example
Automated tests types on Magento 2 example
 
Mastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium SuccessfullyMastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium Successfully
 
Continuous integration CloudParty 21 may 2014 - Milan
Continuous integration CloudParty 21 may 2014 - MilanContinuous integration CloudParty 21 may 2014 - Milan
Continuous integration CloudParty 21 may 2014 - Milan
 
Unit Testing your React / Redux app (@BucharestJS)
Unit Testing your React / Redux app (@BucharestJS)Unit Testing your React / Redux app (@BucharestJS)
Unit Testing your React / Redux app (@BucharestJS)
 
Continuous Integration
Continuous IntegrationContinuous Integration
Continuous Integration
 
Dicoding Developer Coaching #13: Android | Melakukan Testing secara Otomatis ...
Dicoding Developer Coaching #13: Android | Melakukan Testing secara Otomatis ...Dicoding Developer Coaching #13: Android | Melakukan Testing secara Otomatis ...
Dicoding Developer Coaching #13: Android | Melakukan Testing secara Otomatis ...
 
Migration from AngularJS to Angular
Migration from AngularJS to AngularMigration from AngularJS to Angular
Migration from AngularJS to Angular
 
Test Automation Pyramid
Test Automation PyramidTest Automation Pyramid
Test Automation Pyramid
 
Agile Testing…or Walking Dead Testing?
Agile Testing…or Walking Dead Testing?Agile Testing…or Walking Dead Testing?
Agile Testing…or Walking Dead Testing?
 
Игорь Бондаренко (Neklo) - Организация процесса разработки модулей для Magento
Игорь Бондаренко (Neklo) - Организация процесса разработки модулей для MagentoИгорь Бондаренко (Neklo) - Организация процесса разработки модулей для Magento
Игорь Бондаренко (Neklo) - Организация процесса разработки модулей для Magento
 
Put "fast" back in "fast feedback"
Put "fast" back in "fast feedback"Put "fast" back in "fast feedback"
Put "fast" back in "fast feedback"
 
Integration Testing in Enterprises using TaaS
Integration Testing in Enterprises using TaaSIntegration Testing in Enterprises using TaaS
Integration Testing in Enterprises using TaaS
 
How to go about testing in React?
How to go about testing in React? How to go about testing in React?
How to go about testing in React?
 
Qtp testing
Qtp testingQtp testing
Qtp testing
 
TestWorks Conf Performance testing made easy with gatling - Guillaume Corré
TestWorks Conf Performance testing made easy with gatling - Guillaume CorréTestWorks Conf Performance testing made easy with gatling - Guillaume Corré
TestWorks Conf Performance testing made easy with gatling - Guillaume Corré
 
Tasting Your First Test Burger
Tasting Your First Test BurgerTasting Your First Test Burger
Tasting Your First Test Burger
 

Ähnlich wie How to push a react js application in production and sleep better

Dive into Angular, part 5: Experience
Dive into Angular, part 5: ExperienceDive into Angular, part 5: Experience
Dive into Angular, part 5: ExperienceOleksii Prohonnyi
 
Open Source Power Tools - Opensouthcode 2018-06-02
Open Source Power Tools - Opensouthcode 2018-06-02Open Source Power Tools - Opensouthcode 2018-06-02
Open Source Power Tools - Opensouthcode 2018-06-02Jorge Hidalgo
 
Automated Testing in Angular Slides
Automated Testing in Angular SlidesAutomated Testing in Angular Slides
Automated Testing in Angular SlidesJim Lynch
 
JavaOne 2017 CON2902 - Java Code Inspection and Testing Power Tools
JavaOne 2017 CON2902 - Java Code Inspection and Testing Power ToolsJavaOne 2017 CON2902 - Java Code Inspection and Testing Power Tools
JavaOne 2017 CON2902 - Java Code Inspection and Testing Power ToolsJorge Hidalgo
 
Testing Vue Apps with Cypress.io (STLJS Meetup April 2018)
Testing Vue Apps with Cypress.io (STLJS Meetup April 2018)Testing Vue Apps with Cypress.io (STLJS Meetup April 2018)
Testing Vue Apps with Cypress.io (STLJS Meetup April 2018)Christian Catalan
 
Gatling - Bordeaux JUG
Gatling - Bordeaux JUGGatling - Bordeaux JUG
Gatling - Bordeaux JUGslandelle
 
Testing in FrontEnd World by Nikita Galkin
Testing in FrontEnd World by Nikita GalkinTesting in FrontEnd World by Nikita Galkin
Testing in FrontEnd World by Nikita GalkinSigma Software
 
Pain Driven Development by Alexandr Sugak
Pain Driven Development by Alexandr SugakPain Driven Development by Alexandr Sugak
Pain Driven Development by Alexandr SugakSigma Software
 
RandomTest - Random Software Integration Tests That Just Work for C/C++, Java...
RandomTest - Random Software Integration Tests That Just Work for C/C++, Java...RandomTest - Random Software Integration Tests That Just Work for C/C++, Java...
RandomTest - Random Software Integration Tests That Just Work for C/C++, Java...dcieslak
 
Unit testing for ext js apps using sencha test - Walkingtree Technologies
Unit testing for ext js apps using sencha test - Walkingtree TechnologiesUnit testing for ext js apps using sencha test - Walkingtree Technologies
Unit testing for ext js apps using sencha test - Walkingtree TechnologiesWalking Tree Technologies
 
Play with Testing on Android - Gilang Ramadhan (Academy Content Writer at Dic...
Play with Testing on Android - Gilang Ramadhan (Academy Content Writer at Dic...Play with Testing on Android - Gilang Ramadhan (Academy Content Writer at Dic...
Play with Testing on Android - Gilang Ramadhan (Academy Content Writer at Dic...DicodingEvent
 
What is the best approach to tdd
What is the best approach to tddWhat is the best approach to tdd
What is the best approach to tddRed Hat
 
Real World AngularJS recipes: beyond TodoMVC - Carlo Bonamico, Sonia Pini - C...
Real World AngularJS recipes: beyond TodoMVC - Carlo Bonamico, Sonia Pini - C...Real World AngularJS recipes: beyond TodoMVC - Carlo Bonamico, Sonia Pini - C...
Real World AngularJS recipes: beyond TodoMVC - Carlo Bonamico, Sonia Pini - C...Codemotion
 
Real World AngularJS recipes: beyond TodoMVC
Real World AngularJS recipes: beyond TodoMVCReal World AngularJS recipes: beyond TodoMVC
Real World AngularJS recipes: beyond TodoMVCCarlo Bonamico
 
Agile A to Z Chapter 4 Feedback Loop Part 2 DevOps
Agile A to Z Chapter 4 Feedback Loop Part 2 DevOpsAgile A to Z Chapter 4 Feedback Loop Part 2 DevOps
Agile A to Z Chapter 4 Feedback Loop Part 2 DevOpsAgile ME
 
How create react app help in creating a new react applications
How create react app help in creating a new react applications How create react app help in creating a new react applications
How create react app help in creating a new react applications Concetto Labs
 

Ähnlich wie How to push a react js application in production and sleep better (20)

Dive into Angular, part 5: Experience
Dive into Angular, part 5: ExperienceDive into Angular, part 5: Experience
Dive into Angular, part 5: Experience
 
Open Source Power Tools - Opensouthcode 2018-06-02
Open Source Power Tools - Opensouthcode 2018-06-02Open Source Power Tools - Opensouthcode 2018-06-02
Open Source Power Tools - Opensouthcode 2018-06-02
 
Automated Testing in Angular Slides
Automated Testing in Angular SlidesAutomated Testing in Angular Slides
Automated Testing in Angular Slides
 
JavaOne 2017 CON2902 - Java Code Inspection and Testing Power Tools
JavaOne 2017 CON2902 - Java Code Inspection and Testing Power ToolsJavaOne 2017 CON2902 - Java Code Inspection and Testing Power Tools
JavaOne 2017 CON2902 - Java Code Inspection and Testing Power Tools
 
Testing Vue Apps with Cypress.io (STLJS Meetup April 2018)
Testing Vue Apps with Cypress.io (STLJS Meetup April 2018)Testing Vue Apps with Cypress.io (STLJS Meetup April 2018)
Testing Vue Apps with Cypress.io (STLJS Meetup April 2018)
 
DCVCS using GIT
DCVCS using GITDCVCS using GIT
DCVCS using GIT
 
Gatling - Bordeaux JUG
Gatling - Bordeaux JUGGatling - Bordeaux JUG
Gatling - Bordeaux JUG
 
Testing in FrontEnd World by Nikita Galkin
Testing in FrontEnd World by Nikita GalkinTesting in FrontEnd World by Nikita Galkin
Testing in FrontEnd World by Nikita Galkin
 
Pain Driven Development by Alexandr Sugak
Pain Driven Development by Alexandr SugakPain Driven Development by Alexandr Sugak
Pain Driven Development by Alexandr Sugak
 
Vue.js Use Cases
Vue.js Use CasesVue.js Use Cases
Vue.js Use Cases
 
RandomTest - Random Software Integration Tests That Just Work for C/C++, Java...
RandomTest - Random Software Integration Tests That Just Work for C/C++, Java...RandomTest - Random Software Integration Tests That Just Work for C/C++, Java...
RandomTest - Random Software Integration Tests That Just Work for C/C++, Java...
 
Wso2con test-automation
Wso2con test-automationWso2con test-automation
Wso2con test-automation
 
Unit testing for ext js apps using sencha test - Walkingtree Technologies
Unit testing for ext js apps using sencha test - Walkingtree TechnologiesUnit testing for ext js apps using sencha test - Walkingtree Technologies
Unit testing for ext js apps using sencha test - Walkingtree Technologies
 
Play with Testing on Android - Gilang Ramadhan (Academy Content Writer at Dic...
Play with Testing on Android - Gilang Ramadhan (Academy Content Writer at Dic...Play with Testing on Android - Gilang Ramadhan (Academy Content Writer at Dic...
Play with Testing on Android - Gilang Ramadhan (Academy Content Writer at Dic...
 
What is the best approach to tdd
What is the best approach to tddWhat is the best approach to tdd
What is the best approach to tdd
 
Real World AngularJS recipes: beyond TodoMVC - Carlo Bonamico, Sonia Pini - C...
Real World AngularJS recipes: beyond TodoMVC - Carlo Bonamico, Sonia Pini - C...Real World AngularJS recipes: beyond TodoMVC - Carlo Bonamico, Sonia Pini - C...
Real World AngularJS recipes: beyond TodoMVC - Carlo Bonamico, Sonia Pini - C...
 
Real World AngularJS recipes: beyond TodoMVC
Real World AngularJS recipes: beyond TodoMVCReal World AngularJS recipes: beyond TodoMVC
Real World AngularJS recipes: beyond TodoMVC
 
Agile A to Z Chapter 4 Feedback Loop Part 2 DevOps
Agile A to Z Chapter 4 Feedback Loop Part 2 DevOpsAgile A to Z Chapter 4 Feedback Loop Part 2 DevOps
Agile A to Z Chapter 4 Feedback Loop Part 2 DevOps
 
Introduction to Unit Tests and TDD
Introduction to Unit Tests and TDDIntroduction to Unit Tests and TDD
Introduction to Unit Tests and TDD
 
How create react app help in creating a new react applications
How create react app help in creating a new react applications How create react app help in creating a new react applications
How create react app help in creating a new react applications
 

Mehr von Emanuele Rampichini

What is quality? Why should i care?
What is quality? Why should i care? What is quality? Why should i care?
What is quality? Why should i care? Emanuele Rampichini
 
I segreti di una campagna di crowdfunding civico di successo
I segreti di una campagna di crowdfunding civico di successoI segreti di una campagna di crowdfunding civico di successo
I segreti di una campagna di crowdfunding civico di successoEmanuele Rampichini
 
Lavorare con tecnologie "Cool" senza rinunciare all'accessibilità
Lavorare con tecnologie "Cool" senza rinunciare all'accessibilitàLavorare con tecnologie "Cool" senza rinunciare all'accessibilità
Lavorare con tecnologie "Cool" senza rinunciare all'accessibilitàEmanuele Rampichini
 
Building a Desktop Streaming console with Electron and ReactJS
Building a Desktop Streaming console with Electron and ReactJSBuilding a Desktop Streaming console with Electron and ReactJS
Building a Desktop Streaming console with Electron and ReactJSEmanuele Rampichini
 
Building a Desktop Streaming console with Node.js and WebKit
Building a Desktop Streaming console with Node.js and WebKitBuilding a Desktop Streaming console with Node.js and WebKit
Building a Desktop Streaming console with Node.js and WebKitEmanuele Rampichini
 
Speed up your Titanium app development with automated tests - TiConf EU 2014
Speed up your Titanium app development with automated tests - TiConf EU 2014Speed up your Titanium app development with automated tests - TiConf EU 2014
Speed up your Titanium app development with automated tests - TiConf EU 2014Emanuele Rampichini
 
AngularDevConf - Tools and testing
AngularDevConf - Tools and testingAngularDevConf - Tools and testing
AngularDevConf - Tools and testingEmanuele Rampichini
 
Coderetreat 2013 @cowo42 (Osimo - AN)
Coderetreat 2013 @cowo42 (Osimo - AN)Coderetreat 2013 @cowo42 (Osimo - AN)
Coderetreat 2013 @cowo42 (Osimo - AN)Emanuele Rampichini
 

Mehr von Emanuele Rampichini (8)

What is quality? Why should i care?
What is quality? Why should i care? What is quality? Why should i care?
What is quality? Why should i care?
 
I segreti di una campagna di crowdfunding civico di successo
I segreti di una campagna di crowdfunding civico di successoI segreti di una campagna di crowdfunding civico di successo
I segreti di una campagna di crowdfunding civico di successo
 
Lavorare con tecnologie "Cool" senza rinunciare all'accessibilità
Lavorare con tecnologie "Cool" senza rinunciare all'accessibilitàLavorare con tecnologie "Cool" senza rinunciare all'accessibilità
Lavorare con tecnologie "Cool" senza rinunciare all'accessibilità
 
Building a Desktop Streaming console with Electron and ReactJS
Building a Desktop Streaming console with Electron and ReactJSBuilding a Desktop Streaming console with Electron and ReactJS
Building a Desktop Streaming console with Electron and ReactJS
 
Building a Desktop Streaming console with Node.js and WebKit
Building a Desktop Streaming console with Node.js and WebKitBuilding a Desktop Streaming console with Node.js and WebKit
Building a Desktop Streaming console with Node.js and WebKit
 
Speed up your Titanium app development with automated tests - TiConf EU 2014
Speed up your Titanium app development with automated tests - TiConf EU 2014Speed up your Titanium app development with automated tests - TiConf EU 2014
Speed up your Titanium app development with automated tests - TiConf EU 2014
 
AngularDevConf - Tools and testing
AngularDevConf - Tools and testingAngularDevConf - Tools and testing
AngularDevConf - Tools and testing
 
Coderetreat 2013 @cowo42 (Osimo - AN)
Coderetreat 2013 @cowo42 (Osimo - AN)Coderetreat 2013 @cowo42 (Osimo - AN)
Coderetreat 2013 @cowo42 (Osimo - AN)
 

Kürzlich hochgeladen

WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...masabamasaba
 
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburgmasabamasaba
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech studentsHimanshiGarg82
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyviewmasabamasaba
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrainmasabamasaba
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension AidPhilip Schwarz
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareJim McKeeth
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastPapp Krisztián
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrandmasabamasaba
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfonteinmasabamasaba
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park masabamasaba
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...SelfMade bd
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Hararemasabamasaba
 
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benonimasabamasaba
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024VictoriaMetrics
 

Kürzlich hochgeladen (20)

WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare
 
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 

How to push a react js application in production and sleep better

  • 1. How to push a ReactJS application in production and sleep better Emanuele Rampichini Application Engineer @spreaker
  • 2. So, you are building a large ReactJS single page application... 2 ● Do you need it? ● Are you sure? ● 100% Sure? ● I’m gonna ask it again... ● ARE YOU SURE?
  • 6. Monitor your ReactJS application in production Monitoring your application in production is crucial even if you don’t write tests. The good news is that nowadays is quite easy 6 ● https://sentry.io ● https://newrelic.com ● https://trackjs.com
  • 7.
  • 9. Let’s start by defining some testing concepts... Test families ordered from the cheapest to the most expensive one. Cost is a mix of write difficulty, execution time, and maintenance effort requested. 9 ● Unit Tests ● Integration Tests (or midway) ● End 2 End Tests ● Manual Tests
  • 10. LET’S SEE HOW TO FIT THIS INSIDE A REACT + REDUX APP
  • 11. Useful tools to do unit testing in ReactJs 11 ● https://karma-runner.github.io/1 .0/index.html ● http://jasmine.github.io/ ● http://phantomjs.org/ ● Look for Karma + Webpack + PhantomJS on google and you are gonna find a lot of tutorials to create your setup.
  • 12. Unit testing a reducer function is a piece of cake... really! We are just testing pure functions (without side effects) in the form: (State, Action) => State These tests are very good to ensure correctness of your state mutation logic. 12
  • 13.
  • 14.
  • 15. Unit testing components rendering Given some props we want to ensure the correctness of the rendered output. 15 ● https://facebook.github.io/react /docs/test-utils.html ● Shallow Renderer ● https://github.com/sheepsteak /react-shallow-testutils ● https://github.com/airbnb/enzy me
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21. Unit testing components behaviour We want to ensure that when something happens on our component (lifecycle callbacks, clicks etc...) the right action get dispatched to our store. 21 ● http://jasmine.github.io/2.0/intr oduction.html#section-Spies ● Lifecycle: getMountedInstance() ● UI interaction: getOutput()
  • 22.
  • 23.
  • 24. Unit testing middlewares and rich actions (thunk) We want to ensure that a rich action dispatches the right simple actions in the right order to our store when some preconditions are met. 24 ● https://github.com/arnaudbenar d/redux-mock-store ● http://jasmine.github.io/2.0/intr oduction.html#section-Spies
  • 25.
  • 26.
  • 27. Midway testing We want to test components only mocking things at the lower level in our architecture (ex. xhr request). Every other piece is gonna be the real application code. 27 ● https://github.com/jasmine/jas mine-ajax ● Setup can be tricky, ensures that all the pieces are working well together.
  • 28. End 2 End testing with protractor In that case we want to interact directly with our application, we ignore completely the fact that we are testing a reactJS app. These tests are quite slow to run, hard to maintain and they require full control of your backend data. 28 ● http://www.protractortest.org/ ● Expected Conditions ● browser.ignoreSynchronization=true
  • 29. Manual testing on multiple devices These test are the most expensive ones, still they are crucial. Be sure to have as many real devices as you can. Here are some tips: 29 ● Build your own device wall ● Have a staging environment that maps 1:1 the production one and do internal testing. ● Adopt canary deployment strategies
  • 30. IT’S NOT HUGE BUT WE BUILT IT... 30
  • 31. A LOT OF TESTS TO WRITE AND TO MAINTAIN… NOT A LOT OF TIME 31
  • 32. ▫ It’s OK not to test everything ▫ At first you are gonna be super slow, then you are gonna improve. Training is crucial. ▫ If you don’t have time to implement tests just take some to write test definitions and mark them as skipped. You can add coverage when you have slack time. (xdescribe, xit )
  • 33. P.S. WE ARE HIRING, IF YOU ARE INTERESTED OR YOU JUST WANT A T-SHIRT JUST PING ME
  • 34. Thanks. EMANUELE RAMPICHINI APPLICATION ENGINEER @spreaker Get It Touch emanuele.rampichini@spreaker.com @emanuele_r