Get Started with Lab Testing โ

Get up and running with Optima's Lab Testing also in under 5 minutes. This guide will walk you through setting up automated Lighthouse audits for controlled performance analysis.
Prerequisites
Before you begin, make sure you have:
- A publicly accessible website or staging environment
- Basic understanding of web performance metrics
- An Optima account (sign up at optimajs.com)
๐ Step 1: Create Your Account & Project โ
- Sign up at optimajs.com
- Verify your email address
- Create your organization or accept a team invitation
- Create your first project for Lab Testing
No SDK Required
Unlike RUM, Lab Testing doesn't require any code changes to your application. We test your site externally using Google's Lighthouse.
๐งช Step 2: Create Your First Lab Test โ
Navigate to Lab Testing โ
- Go to your project dashboard
- Click "Lab Testing" in the sidebar
- Click "New Lab Test" or "Create Test"
Configure Your Test โ
Fill out the test configuration form:
// Example test configuration
{
"name": "Homepage Performance Test",
"url": "https://yoursite.com",
"device": "desktop", // or "mobile"
"network": "4g", // Options: "4g", "3g", "slow-3g", "cable"
"schedule": {
"frequency": "daily", // Options: "hourly", "daily", "weekly"
"time": "09:00" // UTC time for daily/weekly tests
},
"categories": [
"performance",
"accessibility",
"best-practices",
"seo"
],
"advanced": {
"throttling": true,
"emulatedFormFactor": "desktop",
"locale": "en-US",
"customUserAgent": "" // Optional
}
}Test Configuration Options โ
Device Types โ
- Desktop: Standard desktop browser simulation
- Mobile: Mobile device simulation (Nexus 5X)
Network Conditions โ
- Cable: High-speed broadband (5 Mbps down, 1 Mbps up)
- 4G: Mobile 4G (1.6 Mbps down, 750 Kbps up, 150ms RTT)
- 3G: Mobile 3G (400 Kbps down, 400 Kbps up, 300ms RTT)
- Slow 3G: Slow mobile connection (400 Kbps down, 400 Kbps up, 2000ms RTT)
Audit Categories โ
- Performance: Core Web Vitals, load times, optimization opportunities
- Accessibility: WCAG compliance, screen reader compatibility
- Best Practices: Security, modern web standards
- SEO: Search engine optimization factors
โฐ Step 3: Schedule Your Tests โ
Scheduling Options โ
One-time Test โ
Run immediately for quick analysis:
{
"schedule": {
"type": "immediate"
}
}Recurring Tests โ
Set up automated testing:
Daily Tests:
{
"schedule": {
"frequency": "daily",
"time": "09:00", // UTC
"timezone": "America/New_York" // Optional
}
}Weekly Tests:
{
"schedule": {
"frequency": "weekly",
"day": "monday", // monday, tuesday, etc.
"time": "09:00"
}
}Hourly Tests:
{
"schedule": {
"frequency": "hourly",
"interval": 6 // Every 6 hours
}
}๐ Step 4: Understanding Your Results โ
Performance Scores โ
Lab tests provide detailed performance metrics:
Core Web Vitals โ
- Largest Contentful Paint (LCP): Loading performance
- First Input Delay (FID): Interactivity (simulated)
- Cumulative Layout Shift (CLS): Visual stability
Additional Metrics โ
- First Contentful Paint (FCP): Time to first content
- Speed Index: How quickly content is visually displayed
- Time to Interactive (TTI): When page becomes fully interactive
- Total Blocking Time (TBT): Main thread blocking time
Opportunities & Diagnostics โ
Each test provides actionable recommendations:
- Eliminate render-blocking resources
- Properly size images
- Defer offscreen images
- Minify CSS/JavaScript
- Use efficient cache policies
๐ Step 5: Compare and Track Progress โ
Historical Comparisons โ
- Trend Analysis: Track performance over time
- Before/After: Compare deployments
- Regression Detection: Identify performance degradations
Alerts & Notifications โ
Set up alerts for performance thresholds:
{
"alerts": {
"performance": {
"threshold": 90, // Alert if score drops below 90
"enabled": true
},
"lcp": {
"threshold": 2.5, // Alert if LCP > 2.5s
"enabled": true
}
},
"notifications": {
"email": ["team@yourcompany.com"],
"slack": {
"webhook": "your-slack-webhook-url",
"channel": "#performance"
}
}
}๐ง Advanced Configuration โ
Custom Headers โ
Add authentication or custom headers:
{
"advanced": {
"customHeaders": {
"Authorization": "Bearer your-token",
"X-Custom-Header": "value"
}
}
}Multiple URLs โ
Test multiple pages in sequence:
{
"urls": [
"https://yoursite.com/",
"https://yoursite.com/products",
"https://yoursite.com/checkout"
]
}Budget Assertions โ
Set performance budgets:
{
"budgets": {
"performance": 90,
"lcp": 2.5,
"fcp": 1.8,
"cls": 0.1
}
}๐ CI/CD Integration โ
GitHub Actions โ
Integrate with your deployment pipeline:
name: Performance Testing
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
performance:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run Optima Lab Test
run: |
curl -X POST "https://api.optimajs.com/v1/lab-tests" \
-H "Authorization: Bearer ${{ secrets.OPTIMA_API_KEY }}" \
-H "Content-Type: application/json" \
-d '{
"url": "https://your-staging-site.com",
"device": "desktop",
"wait": true
}'API Integration โ
Use our REST API for custom integrations:
# Create a test
curl -X POST "https://api.optimajs.com/v1/lab-tests" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://yoursite.com",
"device": "mobile",
"network": "4g"
}'
# Get test results
curl -X GET "https://api.optimajs.com/v1/lab-tests/{test-id}" \
-H "Authorization: Bearer YOUR_API_KEY"๐ Best Practices โ
Test Strategy โ
- Baseline Testing: Establish performance baselines
- Pre-deployment: Test before going live
- Regular Monitoring: Schedule recurring tests
- Critical Path: Focus on key user journeys
Optimization Workflow โ
- Identify Issues: Use test recommendations
- Prioritize Fixes: Focus on high-impact optimizations
- Implement Changes: Make performance improvements
- Validate: Run new tests to confirm improvements
- Monitor: Set up alerts for regression detection
๐จ Troubleshooting โ
Common Issues โ
Tests Failing to Run:
- Verify URL is publicly accessible
- Check for authentication requirements
- Ensure site responds within timeout limits
Inconsistent Results:
- Network conditions affect results
- Server load can impact performance
- Consider running multiple tests for averages
Missing Data:
- Some metrics require specific page conditions
- JavaScript-heavy sites may need longer timeouts
- Check for blocking resources or errors
โ Next Steps โ
Now that you have Lab Testing set up:
- Analyze Results - Review your first test results
- Set Up Monitoring - Schedule regular tests
- Configure Alerts - Get notified of performance issues
- Optimize Performance - Implement recommended improvements
- Add RUM - Complement with real user data
Pro Tip
Combine Lab Testing with our Real User Monitoring for complete performance visibility. Lab Testing provides controlled analysis while RUM shows real-world user experience.