MySQL, Node & Testcontainers Testing Done Right
summary
Shows using Testcontainers to spin a throwaway MySQL Docker instance with one line (new MySQLContainer().start()), the Node built-in test runner to run suites, and the MySQL X DevAPI + Faker to insert and verify data; demo creates a user table via a DDL script, runs two tests (container check and create-user) that take ~69ms and ~23ms, and cleanly shuts the container down. Emphasizes isolated test database per suite, avoid hard‑coded values, and using a separate data‑utils SQL check rather than the production repository code.
AI-written summary · about
chapters (11)
- 0:00Introduction and speaker intro
- 1:12Why testing matters
- 4:04Unit vs integration tests
- 7:15Challenges of testing with databases
- 10:06Introducing Testcontainers
- 12:33Node test runner overview
- 17:29Demo setup with Testcontainers
- 23:31Code walkthrough: user repository
- 27:04Code walkthrough: data utils
- 32:26Best practices for testing
- 39:34Resources and Q&A
related talks
15mTake Control of your Integration Testing with Testcontainers
30mIntegration tests & testContainers
39mAndres Almiray: Setting Up Data Driven Tests
21mTest Containers: Where Every Test Starts Fresh
48mMaking Your Testcontainers Experience Smoother
48mContainers for Real Integration Tests
24mIntegration Testing Made Easy: Leveraging Testcontainers and
40mIntegration tests & testContainers
