Talk Overview
Stop accepting slow tests as “just the way it is.”
Your Spring Boot test suite doesn’t have to take 20+ minutes. This session shows you how to achieve 70% speed improvements without rewriting tests or adopting new frameworks - just smarter use of Spring’s built-in capabilities.
Through live benchmarking and real-world examples, you’ll see exactly where those performance gains come from and learn how to apply them to your own projects.
The Speed Problem
The Reality:
- Developers waiting 20+ minutes for test feedback
- CI/CD pipelines that bottleneck deployments
- Context restarts happening dozens of times per test run
- Teams avoiding running tests locally because they’re too slow
The Impact:
- Delayed feedback loops
- Reduced productivity
- Slower release cycles
- Developer frustration
The Hidden Performance Feature
Spring’s TestContext caching is incredibly powerful, but most developers don’t understand how it works or how to leverage it effectively.
You’ll Learn:
- How Spring decides when to reuse vs rebuild contexts
- What the context cache key actually includes
- Why tiny configuration differences kill performance
- How to design tests for maximum reuse
The Silent Performance Killers
1. @MockBean Overuse
The Problem: Every unique @MockBean combination creates a new context.
What You’ll Learn:
- Why @MockBean is a context cache killer
- Alternative approaches that maintain speed
- When @MockBean is actually worth the cost
2. Configuration Variations
The Problem: Small property differences multiplying contexts.
What You’ll Learn:
- How to identify configuration conflicts
- Patterns for consistent test configuration
- Strategies to reduce configuration variations
3. Test Execution Order
The Problem: Context thrashing from poor test ordering.
What You’ll Learn:
- How test order affects context reuse
- Tools to visualize context loading patterns
- Optimization strategies for test execution
4. @DirtiesContext Abuse
The Problem: Nuclear option that forces full context reloads.
What You’ll Learn:
- Why @DirtiesContext is almost never the right solution
- Root causes that lead to its usage
- Better alternatives for test isolation
The Optimization Journey
Through live demonstrations, you’ll see:
- Baseline: A real application with 20-minute test runs
- Analysis: Using profiling tools to identify bottlenecks
- Optimization: Applying strategies step by step
- Results: Achieving 6-minute test runs (70% improvement)
Each optimization comes with:
- Before/after benchmarks
- Code examples
- Trade-off analysis
- Implementation guidance
Proven Strategies
Fast Feedback Patterns
- Group tests by context configuration
- Minimize @MockBean usage
- Standardize test configurations
- Leverage test slices effectively
Measurement & Monitoring
- Profile context loading times
- Track context cache statistics
- Identify rogue tests
- Monitor improvements over time
Practical Implementation
- Incremental optimization approach
- Low-risk changes that deliver big wins
- Team adoption strategies
- Maintaining improvements long-term
Session Format
This is a hands-on, benchmark-driven session featuring:
- Live profiling of real Spring Boot applications
- Before/after performance comparisons
- Interactive optimization sessions
- Audience participation in identifying bottlenecks
You’ll see actual build times drop in real-time as we apply each strategy.
Real Results
Teams who’ve applied these strategies have achieved:
- 78% reduction in test execution time (22 min → 5 min)
- 85% fewer context reloads
- 3x faster developer feedback loops
- 50% shorter CI/CD pipeline times
These aren’t theoretical - they’re results from production applications.
Who Should Attend
Perfect for:
- Teams with test suites taking 15+ minutes
- Developers tired of slow feedback loops
- Engineering leaders seeking productivity improvements
- Anyone who’s ever added
@DirtiesContextwithout understanding why
What You’ll Leave With
- Understanding of Spring’s TestContext caching internals
- Concrete strategies to optimize your test suite
- Tools and techniques for profiling test performance
- An action plan to achieve 70% speed improvements
- Code patterns you can implement immediately
Beyond the Basics
This isn’t about “run tests in parallel” or “use a faster CI server.” This is about fundamentally understanding how Spring Boot manages test contexts and leveraging that knowledge for dramatic performance gains.
Stop accepting slow tests. Start shipping faster.