Stop creating garbage test data. Start building production-quality test objects!
Test automation is only as good as the data it uses. Random strings and hardcoded values lead to flaky tests and missed bugs. This workshop teaches you the Builder Pattern, a powerful way to create realistic, valid, and maintainable test data that mirrors your production environment.
- 🎯 Create type-safe test objects that match your business models
- 🔄 Build reusable, chainable builders for complex data structures
- 🎲 Generate realistic fake data using Faker.js
- 🧪 Design flexible test data for edge cases and boundary testing
- 🚀 Scale your test data creation with Director patterns
By the end, you'll have builders that create business-valid test data every time. No more hunting down why your tests failed because of invalid postal codes or malformed UUIDs!
Let's build something awesome!
Follow the installation document before moving on to the exercises.
- Exercise 1: Understanding Type Safety - The Difference Between Flexible and Strict Code
- Exercise 2: Create Missing Types - Building Your Own Blueprints
- Exercise 3: The first builder, the Address builder, let's run!
- Exercise 4: Fix Postal Code Format & Explore Fake Data Magic
- Exercise 5: Build Your Own Builder - Creating the Contact Builder
- Exercise 6: The Grand Finale - Creating the Complete Person Builder
- Exercise 7: Custom Builder Methods - Making Testing Life Easier
- Exercise 8: Future-Proof Date Testing - Mastering Time Travel
- Exercise 9: The Director Pattern - Orchestrating Massive Data Creation
- Exercise 10: Use the
@cerios/cerios-builderPackage - Exercise 11: Create Your Own Domain - Master Challenge
If you want to read more about the builder pattern in a schematic way. Click here
