Integration Testing from the Trenches
summary
Integration testing focuses on real collaborations: use Maven failsafe (remember failsafe requires IT suffix) to keep CI unit builds under five minutes, fake web services with an embedded Spark HTTP server or SoapUI mocks, and prefer H2 use H2 in Mode for DB compatibility over HSQL for faster local runs. Test in-container with Spring Test, TestNG ordering and Arquillian+ShrinkWrap for multiple servers, use a single small connection pool to detect leaks, and favor Java config over XML.
AI-written summary · about
chapters (13)
- 0:00Start
- 6:06The SUT is what get tested Techniques from Unit Testing can be re-used Dependency injection Test doubles
- 10:19Separate Integration Tests from Unit Tests Fake required Infrastructure resources Test in-container
- 18:53In-memory databases are easy to setup h2 is such a database (successor of HSQL) Compatibility modes for most widespread DB
- 21:46SPARK
- 31:091. Main fragment Repository Service etc 2. Prod De fragment 3. Test DB fragment
- 34:43Get access to both The entry point And the end point Spring Test to the rescue Integration with common Testing frameworks
- 35:33Extra grouping Per layer Per use-case Name your own Extra lifecycle hooks Better parameterization Data Provider Ordering of test methods
- 39:13Transactions Bound to business functionality Implemented on Service layer With DAO Use explicit transaction management Transactional
- 40:31By default Spring rollbacks transactions General configuration @Transaction Configuration
- 42:26Require a context hierachy Parent as main context Child as webapp context ContextHierarchy Require a webapp configuration WebAppConfiguration
- 51:432 Java EE
- 55:03Abstraction layer to Download Deploy applications Test Container adapters
related talks
58mIntegration Testing from the Trenches
40mIntegration Testing from the Trenches - Rebooted
44mTesting: Integration Tests - The good, bad and ugly
47mIntegration Tests: testcontainers to the Rescue
47mMicroservices Testing with Java
02h 36mTesting Java Microservice
54mExploring Jakarta EE integration testing
52mIntegration tests are needed and simple
