Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Testing Serverless Applications - Serverless Da...

Testing Serverless Applications - Serverless Days Cardiff 2019

My presentation from Serverless Days Cardiff 2019: https://cardiff.serverlessdays.io.

More info about the presentation: https://cardiff.serverlessdays.io/talk-slobodan-stojanovic.html.

Slobodan Stojanović

January 30, 2019
Tweet

More Decks by Slobodan Stojanović

Other Decks in Programming

Transcript

  1. @slobodan_ Slobodan Stojanovic CTO @ Cloud Horizon and CTO @

    VacationTracker.io co-author of Serverless Applications with Node.js book AWS Serverless Hero @slobodan_ serverless.pub
  2. @slobodan_ • Azure Functions Core Tools (for Azure functions) •

    AWS SAM CLI (for AWS SAM) • third-party tools (ie. localstack) • docker-lambda for AWS Lambda local simulation • run Node.js function locally • and more…
  3. @slobodan_ You can run parts of your code locally to

    speed up the development, but not everything
  4. @slobodan_ • Jasmine • Mocha • Jest • any other

    popular tool For example, for Node.js you can use:
  5. @slobodan_ Integration tests are cheaper, but also more important, because

    common serverless app is split into many small pieces
  6. @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
  7. @slobodan_ • hexagonal architecture • be smart • test integrations

    that you own • or test your code with a different adapter
  8. @slobodan_ Bonus: You can promote tested function to production, so

    QA tests the same function that will be in production
  9. @slobodan_ Units are smaller and easier to test, but deployment,

    triggers and permissions are not trivial (but they are getting easier and easier)
  10. @slobodan_ • Built-in tools (CloudWatch, X-Ray for AWS) • Epsagon

    • IOpipe • Lumigo • Thundra • and others
  11. @slobodan_ Serverless apps often heavily relies on front end, in

    those cases you need to track front end errors as well
  12. @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 • serverless helps testers to do their job faster and cheaper
  13. @slobodan_ A few things that I mentioned in this talk:

    bit.ly/aws-hexagonal-architecture claudiajs.com desole.io