You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- The `SharedIntegrationTestBase` pattern: one base class → one cached context
565
-
- Scout24 example: 12 contexts → 2 contexts, 45 min → 12 min build time
566
-
- Use consistent `@Import`, `@ContextConfiguration` across all integration tests
549
+
- Spring caches `ApplicationContext` using `MergedContextConfiguration` as the key - identical configs share one context across the suite
550
+
- Before starting, Spring X-rays the test class and merges all annotations, initializers, `@MockitoBean` definitions, and property overrides into the key object; `hashCode`/`equals` decides hit or miss
- JUnit Jupiter parallel execution (`junit-platform.properties`) + Maven Surefire `forkCount` are complementary and multiply each other's speedup
559
+
- Safe parallel integration tests use UUID-prefixed test data or `@Transactional` rollback to prevent cross-test interference
560
+
- Static `@Bean @ServiceConnection` Testcontainers fields share one container instance across all tests in the same context
561
+
- GitHub Actions best practices: `timeout-minutes`, Maven cache, `--fail-at-end` to collect all failures, redirect test output to files
579
562
580
563
---
581
564
582
-
# Workshop Summary
583
-
584
-
## Lab 8 — General Testing Hacks
565
+
## Lab 8 - General Testing Hacks & Libraries
585
566
586
-
-`OutputCaptureExtension` — capture stdout/logs in tests without Spring context
587
-
- Mutation testing with PIT — find weak assertions and untested branches
588
-
- Container log capture — `Slf4jLogConsumer` + `getLogs()` for debugging
589
-
-`@RecordApplicationEvents` — assert Spring application events are published
590
-
-`ApplicationContextRunner` — test conditional beans in milliseconds
591
-
- ArchUnit — enforce layered architecture rules as executable tests
592
-
- GreenMail — test email sending without a real SMTP server
593
-
- TDD with AI — CLAUDE.md conventions, test-first prompting, Diffblue Cover
567
+
-`OutputCaptureExtension`, `Slf4jLogConsumer`, `@RecordApplicationEvents`, `ApplicationContextRunner` - lightweight utilities for targeted testing without a full context
568
+
- PIT mutation testing introduces code mutations automatically: 100% line coverage ≠ 100% confidence; strong assertions are essential
569
+
- ArchUnit enforces layered architecture rules as executable unit tests in CI - soft conventions become hard failures
570
+
- Object Mother pattern centralizes test data creation; GreenMail, Selenide, and Pact fill gaps that Spring Boot's built-in slices do not cover
594
571
595
572
---
596
573
574
+

575
+
597
576
598
-
## Q & A
577
+
## Time for General Q&A
599
578
579
+
- Do you have any questions about the exercises, the solutions, or the general testing tips and libraries we covered?
580
+
- Are there any specific testing challenges you've faced in your projects that you'd like to discuss?
581
+
- Would you like to see a live demo of any of the tools or techniques we covered?
600
582
601
583
602
584
---
603
585
604
586
## Joyful Testing!
605
587
606
-
Workshop materials are on [GitHub](https://github.com/PragmaTech-GmbH/digdir-workshop/)
588
+
Workshop materials are on [GitHub](https://github.com/PragmaTech-GmbH/digdir-workshop/).
0 commit comments