@slobodan_
Allow an application to equally be driven by users,
programs, automated test or batch scripts, and to
be developed and tested in isolation from its
eventual run-time devices and databases.
Alistair Cockburn
Slide 68
Slide 68 text
@slobodan_
Slide 69
Slide 69 text
@slobodan_
Slide 70
Slide 70 text
@slobodan_
Unit testing
Slide 71
Slide 71 text
@slobodan_
Unit testing is the same as for any other app
Slide 72
Slide 72 text
@slobodan_
• small units
• fully covered with tests
• "mock" adapters
Slide 73
Slide 73 text
@slobodan_
Integration testing
Slide 74
Slide 74 text
@slobodan_
Integration tests important than ever
Slide 75
Slide 75 text
@slobodan_
• hexagonal architecture
• be smart
• test integrations that you own
• or test your code with a different adapter
Slide 76
Slide 76 text
@slobodan_
How does this look in practice?
Slide 77
Slide 77 text
@slobodan_
Slide 78
Slide 78 text
@slobodan_
UI testing
Slide 79
Slide 79 text
@slobodan_
Serverless is mainly a back end thing,
why do we mention UI tests?
Slide 80
Slide 80 text
@slobodan_
UI tests are slow and expensive
Slide 81
Slide 81 text
@slobodan_
Benefits of serverless are
cheap infrastructure and easy/fast parallelization
Slide 82
Slide 82 text
@slobodan_
Slide 83
Slide 83 text
@slobodan_
• puppeteer
• appraise.qa
• and others…
Slide 84
Slide 84 text
@slobodan_
Slide 85
Slide 85 text
@slobodan_
CI / CD
Slide 86
Slide 86 text
@slobodan_
It works the same way as any other app
Slide 87
Slide 87 text
@slobodan_
Use your favorite deployment tool from CI
to deploy your serverless app
Slide 88
Slide 88 text
@slobodan_
Popular CI/CD tools
Slide 89
Slide 89 text
@slobodan_
• Jenkins
• Travis CI
• Semaphore CI
• AWS CodeBuild
• and many more
Slide 90
Slide 90 text
@slobodan_
We automated deployment from git branches to
different stages
(ie. production, dev, staging, qa)
Slide 91
Slide 91 text
@slobodan_
Slide 92
Slide 92 text
@slobodan_
Quality Assurance (QA)
Slide 93
Slide 93 text
@slobodan_
Nothing changes?
Slide 94
Slide 94 text
@slobodan_
Stages and deployments are cheap and often fast to setup
Slide 95
Slide 95 text
@slobodan_
You don't pay for your app infrastructure if no-one is using it
Slide 96
Slide 96 text
@slobodan_
Having test environments was never cheaper
Slide 97
Slide 97 text
@slobodan_
Bonus: You can promote tested function to production,
so QA tests the same function that will be in production
Slide 98
Slide 98 text
@slobodan_
One more thing…
Slide 99
Slide 99 text
@slobodan_
Slide 100
Slide 100 text
@slobodan_
Slide 101
Slide 101 text
@slobodan_
Slide 102
Slide 102 text
@slobodan_
Slide 103
Slide 103 text
@slobodan_
Slide 104
Slide 104 text
@slobodan_
Slide 105
Slide 105 text
@slobodan_
Slide 106
Slide 106 text
@slobodan_
Slide 107
Slide 107 text
@slobodan_
Slide 108
Slide 108 text
@slobodan_
Slide 109
Slide 109 text
@slobodan_
Slide 110
Slide 110 text
@slobodan_
And they lived happily ever after…
Slide 111
Slide 111 text
@slobodan_
Slide 112
Slide 112 text
@slobodan_
Slide 113
Slide 113 text
@slobodan_
Risks and challenges
Slide 114
Slide 114 text
@slobodan_
Deployment risk
Slide 115
Slide 115 text
@slobodan_
Units are smaller and easier to test,
but deployment, triggers and permissions are not trivial
(but they are getting easier and easier)
Slide 116
Slide 116 text
@slobodan_
You should use well tested and mature deployment tool
Slide 117
Slide 117 text
@slobodan_
Popular deployment tools
Slide 118
Slide 118 text
@slobodan_
• Serverless Framework
• Claudia.js
• AWS SAM
• .architect
• and many more
Slide 119
Slide 119 text
@slobodan_
Integration errors and changes
Slide 120
Slide 120 text
@slobodan_
Your app might just work*,
but integrations can change and cause failures
Slide 121
Slide 121 text
@slobodan_
How do you make sure they don't?
Slide 122
Slide 122 text
@slobodan_
You can't.
But you should do monitoring and error tracking!
Slide 123
Slide 123 text
@slobodan_
Monitoring/error-tracking tools
Slide 124
Slide 124 text
@slobodan_
• Built-in tools (CloudWatch, X-Ray for AWS)
• Epsagon
• IOpipe
• Dashbird
• Thundra
• and others
Slide 125
Slide 125 text
@slobodan_
Serverless apps often heavily relies on front end,
in those cases you need to track front end errors as well
Slide 126
Slide 126 text
@slobodan_
desole.io
Slide 127
Slide 127 text
@slobodan_
Slide 128
Slide 128 text
@slobodan_
Slide 129
Slide 129 text
@slobodan_
Slide 130
Slide 130 text
@slobodan_
Slide 131
Slide 131 text
@slobodan_
Summary
Slide 132
Slide 132 text
@slobodan_
• you can run/test some parts of serverless app locally
• automated tests are important, but be smart
• use hexagonal architecture to stay flexible
• use CI/CD for tests and deployment to different stages
• QA can test the same function you are deploying to production
• use mature and tested deployment tools, and track and analyze errors
Slide 133
Slide 133 text
@slobodan_
A few things that I mentioned in the talk:
claudiajs.com
desole.io
Slide 134
Slide 134 text
@slobodan_
vacationtracker.io
Slide 135
Slide 135 text
@slobodan_
Slides:
bit.ly/serverless-testing-btc2018
If you prefer article version:
bit.ly/serverless-testing-article
Slide 136
Slide 136 text
@slobodan_
One more thing…
Slide 137
Slide 137 text
@slobodan_
First footage of @slobodan_ and @simalexan
as AWS Serverless Heroes
Private archive
Slide 138
Slide 138 text
@slobodan_
Serverless Applications with Node.js
Use claudia40 promo code
for 40% off
serverless-book.com
@slobodan_