5 Spring Boot Testing Mistakes Developers Trap Into

45-60 minutes

Talk Overview

Your tests are green, your coverage is high, but bugs still slip through to production. Sound familiar?

This session exposes five critical testing mistakes that even experienced Spring Boot developers make - mistakes that look innocent but create unreliable test suites and false confidence.

Through real-world code examples and debugging sessions, you’ll learn to spot these dangerous patterns and transform your tests from liability to asset.

The Five Testing Traps

1. Transaction Rollback Confusion

The Trap: Tests pass with @Transactional, but production code fails because the database state isn’t what you expected.

What You’ll Learn:

  • How Spring’s test transaction management differs from production
  • When rollback hiding real issues
  • Patterns for reliable database testing without surprises

2. Context Pollution Between Tests

The Trap: Tests pass individually but fail when run together. Your CI randomly fails, but you can’t reproduce it locally.

What You’ll Learn:

  • How shared application context state leaks between tests
  • Why @DirtiesContext is a symptom, not a solution
  • Techniques for true test isolation

3. Incorrect WebMvcTest Usage

The Trap: Your @WebMvcTest passes, but the real controller fails in integration tests with cryptic errors.

What You’ll Learn:

  • Common @WebMvcTest configuration mistakes
  • What Spring actually mocks in slice tests
  • When to use @WebMvcTest vs @SpringBootTest

4. Time-Dependent Test Failures

The Trap: Tests fail at midnight, on certain dates, or after running for a few minutes. Flaky tests that erode team confidence.

What You’ll Learn:

  • Hidden time dependencies in your tests
  • How to make tests deterministic regardless of when they run
  • Patterns for testing time-sensitive business logic

5. The Over-Mocking Trap

The Trap: You have 100% coverage, but your mocks hide integration issues. Production fails because components don’t work together.

What You’ll Learn:

  • When mocking does more harm than good
  • The balance between unit and integration tests
  • How to test component interactions reliably

Session Format

This is an interactive code-focused session that combines:

  • Live code examples showing each mistake in action
  • Debugging sessions to understand why tests fail
  • Before/after comparisons with practical solutions
  • Real production scenarios that each mistake enables

The session includes audience participation and Q&A throughout.

Why This Matters

  • Save Time: Stop chasing phantom bugs that tests should have caught
  • Build Confidence: Deploy on Fridays without anxiety
  • Improve Quality: Catch real issues before production
  • Team Impact: Share knowledge to prevent mistakes across the team

Who Should Attend

Perfect for developers who:

  • Have experienced production bugs despite passing tests
  • Struggle with flaky or unreliable tests
  • Want to improve their testing skills beyond the basics
  • Are tired of “hope and pray” deployments

What You’ll Leave With

  • A mental checklist of testing anti-patterns to avoid
  • Practical code patterns you can apply immediately
  • Understanding of why your tests might not be as reliable as you think
  • Confidence to critically evaluate your test suite

Delivery History

This talk addresses the most common issues teams face when testing Spring Boot applications - patterns I’ve seen repeatedly in consulting engagements and code reviews across dozens of projects.

The content is drawn from real production incidents and testing failures, making it immediately relevant and practical for working developers.

Talk Abstract

Your Spring Boot tests are passing, but can you really trust them? This session reveals five critical testing mistakes that silently undermine your test suite's reliability and your confidence in deployments.

We'll tackle the tough questions: Why do tests pass locally but fail in CI? When does @MockBean become your enemy? How can 100% coverage still miss critical bugs? You'll see real examples of tests that look correct but hide serious flaws.

Learn to identify and fix dangerous patterns: transaction rollback confusion, context pollution between tests, incorrect WebMvcTest usage, time-dependent test failures, and the over-mocking trap. Each pitfall comes with practical solutions and alternative approaches.

What You'll Learn

  • Identify the five most common Spring Boot testing mistakes
  • Understand why tests pass locally but fail in CI
  • Learn when @MockBean hurts more than it helps
  • Recognize and fix context pollution between tests
  • Master transaction management in tests
  • Write time-independent tests that don't flake
  • Transform from 'hope it works' to 'know it works'

Prerequisites

  • Experience writing Spring Boot tests
  • Basic understanding of JUnit and Spring testing annotations
  • Familiarity with @SpringBootTest and test slices

Book This Talk

Request Speaking Engagement
We'll discuss your event requirements and customize the presentation for your audience.

Topics Covered:

Transaction Rollback Confusion Context Pollution Between Tests Incorrect WebMvcTest Usage Time-Dependent Test Failures The Over-Mocking Trap Test Reliability Patterns

Target Audience:

  • Spring Boot developers with existing test suites
  • Teams experiencing production issues despite tests passing
  • Developers wanting to improve test reliability
  • QA engineers working with Spring Boot applications

Available For:

conferences meetups corporate events tech talks
Have questions?
Contact us

Ready to bring this talk to your event?

Request Speaking Engagement

Related Talks

Stop Fighting Your Spring Boot Tests

Waited 20+ minutes for tests to run? Skipped running tests locally to 'save time'? Seen tests pass …

45-60 minutes
Learn more →

The Need for Speed: Cut Your Spring Boot Build Times by 70%

Your Spring Boot test suite is a time thief. Every context reload, every unnecessary restart, every …

45-60 minutes
Learn more →

Testing Spring Boot Applications Demystified

Testing Spring Boot applications doesn't have to be overwhelming. This talk demystifies Spring …

60-90 minutes
Learn more →