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

1-13-25 - Quarkus Testing Landscape

1-13-25 - Quarkus Testing Landscape

I will review the various types of tests in Quarkus. I’ll cover unit, integration, mocking, spying, contract testing, and Playwright. I'll also share patterns for testing inner and outer loop processes.

Recording: https://www.youtube.com/live/hxYZHIA1xWc

Avatar for Eric Deandrea

Eric Deandrea

January 13, 2025
Tweet

More Decks by Eric Deandrea

Other Decks in Technology

Transcript

  1. @edeandrea 2 • Java Champion • 25+ years software development

    experience • ~11 years DevOps Architect • Contributor to Open Source projects Quarkus Spring Boot, Spring Framework, Spring Security LangChain4j (& Quarkus LangChain4j) Wiremock Microcks • Boston Java Users ACM Chapter Board Member • Published Author About Me
  2. @edeandrea • Showcase & explain Quarkus, how it enables modern

    Java development & the Kubernetes-native experience • Introduce familiar Spring concepts, constructs, & conventions and how they map to Quarkus • Equivalent code examples between Quarkus and Spring as well as emphasis on testing patterns & practices 3 https://red.ht/quarkus-spring-devs
  3. @edeandrea The “normal” stuff • Unit testing ◦ Isolate a

    “unit” within the application as a standalone entity ◦ Use mocking / spying to control dependencies of the unit during test ◦ Test all potential outcomes of a particular unit • Integration testing ◦ Treat application as a black box ◦ Downstream services (db, message brokers, etc) need to be available ◦ Application should be run & tested as its intended to be deployed 14
  4. @edeandrea The “normal” stuff • Mocking ◦ Complete mock /

    “fake” ◦ User must define interaction(s) ◦ Default behavior if not defined: do nothing ◦ Can verify intended behaviors occurred after test (verification-based testing) • Spying ◦ Partial mock / “real” ◦ User doesn’t need to define interaction(s) ◦ Default behavior if not overridden: perform actual operation ◦ Useful for “watching” things during tests & verifying intended behaviors occurred (verification-based testing) 15 These don’t have to be object-based!!!