Baseline Management in SmartUI
This guide explains how to effectively manage baselines in SmartUI for your visual regression testing workflow.
Understanding Baselines
A baseline in SmartUI represents the reference point for visual regression testing. It's the set of screenshots against which all future builds are compared.
Types of Baselines
- Project Baseline: Set in project settings, used as the default comparison point
- Branch Baseline: Specific to a branch, used when Smart Git is enabled
- Dynamic Baseline: Specified during test execution
- Build Baseline: A specific build marked as baseline
Dynamic Baseline Specification
SmartUI allows you to specify baselines dynamically during test execution, providing flexibility in your testing workflow.
Branch-based Baseline
npx smartui --baselineBranch "branch-name" exec -- <execution command>
Use Cases:
- Testing against a specific branch's latest approved build
- Comparing feature branch against development branch
- Testing hotfix against production branch
Build-based Baseline
npx smartui --baselineBuild "build-name" exec -- <execution command>
Use Cases:
- Testing against a specific build version
- Comparing against a known good build
- Testing against a production build
Mark as Baseline
SmartUI provides the ability to mark builds as baseline directly through the CLI. This overwrites the global baseline branch present in the Project Settings.
Basic Usage
npx smartui --markBaseline exec -- <execution command>
Baseline Management Strategies
1. Feature Development
Scenario: Managing baselines during feature development
# 1. Set feature branch baseline
npx smartui --baselineBranch "feature/new-login" exec -- <execution command>
### 2. Hotfix Management
**Scenario**: Managing baselines for hotfixes
```bash
# 1. Set production as baseline
npx smartui --baselineBranch "production" exec -- <execution command>
3. Release Management
Scenario: Managing baselines for releases
# 1. Set staging as baseline
npx smartui --baselineBranch "staging" upload <dirName>
# 2. Mark release as new baseline
npx smartui --markBaseline capture urls.json
Best Practices
-
Baseline Selection:
- Choose stable builds as baselines
- Document baseline selection criteria
- Regular baseline updates
-
Branch Management:
- Clear branch naming conventions
- Document branch purposes
- Regular branch cleanup
-
Build Management:
- Meaningful build names
- Document build purposes
- Regular build cleanup
-
Approval Process:
- Clear approval criteria
- Document approval decisions
- Maintain audit trail
Troubleshooting
Common Issues
-
Baseline Issues:
- Verify baseline exists
- Check baseline status
- Review baseline history
-
Comparison Issues:
- Verify build compatibility
- Check branch status
- Review comparison settings
-
Permission Issues:
- Verify user permissions
- Check branch protection
- Review access settings
Getting Help
If you encounter any issues with baseline management in SmartUI, please contact our support team at support@lambdatest.com.