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

Testing Cloud Apps: Mocks vs. Service Virtualization vs. Remocal Tools

Testing Cloud Apps: Mocks vs. Service Virtualization vs. Remocal Tools

When enterprises adopt microservices, containers, and cloud native development, the technologies and architectures may change, but the fact remains that we all still add the occasional bug to our code. The main challenges developers now face are performing integration or end-to-end testing without spinning up all of their microservices locally and driving their laptop fans to high speed or breaking the bank by using resource-heavy remote clusters. Join me for this session and:

- Explore challenges with scaling container-based application development and testing
- Learn about effective unit testing with mocks, using TestContainers for dependency testing, and using Telepresence to extend your local testing environment into the cloud
- Understand when to use each type of test and tooling based on your use case and requirements for realism, speed, and practicality
- Explore the benefits and challenges of integration testing conducted locally and using remote clusters

danielbryantuk

March 17, 2024
Tweet

More Decks by danielbryantuk

Other Decks in Technology

Transcript

  1. @danielbryantuk tl;dr 2 • The inner dev/test loop can be

    painful with microservices & Kubernetes • The pain increases as the number of services within your system increase • You have options with +/- : mocks, service virtualisation, remocal tools
  2. @danielbryantuk Inner and outer dev loops 7 Hat tip to

    Mitch Denny (now 404): https://mitchdenny.com/the-inner-loop/ http://jorgemoral.es/posts/2020_03_17-develop_apps… Local: “You’ll pry localhost from my cold dead hands!" Remote: CI/CD/env as a Service” Unit Testing & Integration Testing Component Testing & End-to-end Testing
  3. @danielbryantuk tl;dr 10 “My laptop only has 16GB RAM and

    you’re asking it to run Kubernetes and a JVM and a database???”
  4. @danielbryantuk Inner and outer dev loops with K8s can be

    the same 12 • Write code • Build container • Push to registry • Deploy to cluster • Test And can be …. SLOW.
  5. @danielbryantuk tl;dr 15 And you want to avoid the “works

    on my machine” production vs local dev debacle
  6. @danielbryantuk Testing Microservices: What to use, when 17 Mocks Service

    virtualization Remocal Unit tests ✅ Integration tests ✅ ✅ Component tests ✅ ✅ ✅ End-to-end tests ✅ ✅ Inner loop exploration ✅
  7. @danielbryantuk What are your options? (“Show me the tech!”) 18

    • Mocks • Mockito, PowerMock(ito), Jest, GoMock • Service virtualisation • Testcontainers, LocalStack, (Embedded Datastore/middleware?) • Microcks, Hover fl y, WireMock, Mountebank • Remocal tooling • DevSpace, Okteto, Skaffold, Tilt • Telepresence, mirrord, Gefyra
  8. @danielbryantuk Mocks 20 • Good • Idiomatic (familiar language constructs

    etc) • Quick and cheap • Can help build your mental model (TDD-like) • Bad • Implicit assumptions coded in (“the three realities conundrum”) • Dif fi cult to keep up to date and share/coordinate • Needs a test runner
  9. @danielbryantuk Testing Microservices: What to use, when 21 Mocks Unit

    tests ✅ Integration tests ✅ Component tests ✅ End-to-end tests Inner loop exploration
  10. @danielbryantuk Service virtualisation 25 • Good • More realistic than

    mocks (can be the “real thing”, albeit resource constrained) • Enables (wire-level) deterministic test of failure scenarios • Easy to use large(r) amounts of data • Bad • Slower than mocks to initialise • Can be tricky to con fi gure • Challenging to keep up to date and share (unless dedicated tooling/SaaS used)
  11. @danielbryantuk Testing Microservices: What to use, when 26 Service virtualization

    Unit tests Integration tests ✅ Component tests ✅ End-to-end tests ✅ Inner loop exploration
  12. @danielbryantuk Remocal tooling 29 • Good • Enables testing against

    (and poking of) the real thing • Data sets can be large scale (as resources can be scaled on remote cluster) • No need to build mental model of dependency (both good and bad!) • Bad • Need a solid network connection • Mutating remote shared state can be an issue • Lack of language bindings
  13. @danielbryantuk Testing Microservices: What to use, when 31 Remocal Unit

    tests Integration tests Component tests ✅ End-to-end tests ✅ Inner loop exploration ✅
  14. @danielbryantuk Testing Microservices: What to use, when 34 Mocks Service

    virtualization Remocal Unit tests ✅ Integration tests ✅ ✅ Component tests ✅ ✅ ✅ End-to-end tests ✅ ✅ Inner loop exploration ✅
  15. @danielbryantuk Conclusion 36 • The inner dev/test loop can be

    painful with microservices & Kubernetes • The pain increases as the number of services within your system increase • You have options with +/- : mocks, service virtualisation, remocal tools • The CNCF landscape includes useful testing projects • Choose your dev/test approach wisely!