What You’ll Learn
- The power of branching states at critical decision points
- Parallel testing of different database schemas and features
- Real-world time savings compared to traditional database testing
Prerequisites
- Vers CLI installed and authenticated
- Basic familiarity with databases and SQL
Project Overview
We’ll test different database features and schema changes. Instead of resetting the database and rebuilding test data for each scenario, we’ll:- Set up once: Create a VM with SQLite and base schema
- Branch at decision points: Capture database state before major changes
- Test in parallel: Run different feature implementations simultaneously
- Compare results: Analyze different approaches without data loss
Step 1: Project Setup
Initialize the Project
Configure the Environment
Edit the generatedvers.toml:
Step 2: Launch and Set Up the Environment
Start the VM
Connect and Set Up Database
Create the Base Database Schema
Create Helper Scripts
Step 3: The Critical Branch Point - Pre-Migration State
This is the key moment. We’ve set up our database with base schema and data. Now we’ll branch before making schema changes so we can test different migration approaches.Branch for Different Migration Scenarios
db-root: Original state (preserve as baseline)migration-premium: For testing premium user featuresmigration-inventory: For testing inventory trackingmigration-analytics: For testing analytics tables
Step 4: Apply Different Migrations in Parallel
Migration A: Premium User Features
Migration B: Inventory Management
Open a new terminal (or switch branches):Migration C: Analytics Tables
Step 5: Compare Results
View All VM States
- Root VM: Running parent with the base database state
- Premium Features VM: Running child with premium user features
- Inventory Management VM: Running child with inventory tracking
- Analytics VM: Running child with analytics tables
Compare Schemas
Check what tables exist in each migration:Step 6: The Time Savings
Traditional Database Testing Approach
Vers Approach
Step 7: Advanced Workflows
Testing Rollback Scenarios
Branch before risky operations to test rollback:A/B Testing Migrations
Create two approaches to the same feature:Cleanup
Key Takeaways
- Branch Before Migrations: Always branch before applying schema changes
- Parallel Testing: Test multiple migrations simultaneously
- Safe Experimentation: Each branch is isolated - failures don’t affect other branches
- Preserve Baselines: Keep your root VM as a clean baseline for future branches
Next Steps
- Explore Core Concepts for deeper understanding
- Learn about VM Access for programmatic control
- Try the Parallel Web Testing tutorial