Created: 2025-11-02 Purpose: Guide for creating and using test spreadsheets for regression testing
The regression testing feature allows you to create a safe, sanitized copy of your production CoMapeo configuration spreadsheet for testing purposes. This is essential for validating code changes and bug fixes without risking production data.
ALWAYS create a test spreadsheet before:
- Making code changes to the plugin
- Testing new features
- Running the regression test suite (Task 5)
- Debugging issues
- Validating bug fixes
- Performance testing
NEVER test directly on production spreadsheets
- Open your production spreadsheet
- Click "CoMapeo Tools" menu
- Select "Create Test Spreadsheet for Regression"
- Review the confirmation dialog
- Read what will be sanitized
- Click "Yes" to proceed or "No" to cancel
- Wait for processing
- The plugin creates a new spreadsheet
- All data is copied and sanitized
- Validation runs automatically
- Success dialog shows
- Test spreadsheet URL
- Spreadsheet ID
- Confirmation that it's ready
// Run in Apps Script editor
const result = duplicateSpreadsheetForTesting();
console.log(`Test spreadsheet created: ${result.url}`);| Production Element | Test Replacement | Example |
|---|---|---|
| Dataset ID | comapeo-test-{DATE} |
comapeo-wildlife → comapeo-test-20251102 |
| Spreadsheet Name | TEST_{DATE}_{original} |
Wildlife Survey → TEST_20251102_Wildlife Survey |
| Category Names | Test Category {n} |
River → Test Category 1 |
| Field Names | Test Field {n} |
Width → Test Field 1 |
| Google Drive URLs | Placeholder icon | https://drive.google.com/... → [PLACEHOLDER] |
| Icon References | Default placeholder | Production icons → https://drive.google.com/file/d/1n1jR7XPFBgtpn544f7PMKxN2djewl60K/view?usp=drive_link |
| Helper Text | Generic text | "What is the width?" → "This is test helper text for testing purposes." |
| Options | Test Option {n} |
Small, Medium, Large → Test Option 1, Test Option 2, Test Option 3 |
| Translation Content | (Cleared) | All translations → Empty |
| Colors | Default blue | Any color → #0066CC |
✅ Structure preserved:
- Sheet names and order
- Column headers
- Field types (text, number, single choice checkbox, multi-select)
- Validation rules
- Sheet formatting
✅ Relationships preserved:
- Category → Field references
- Field → Option mappings
- Translation sheet structure
The test spreadsheet undergoes automatic validation to ensure:
- Spreadsheet name starts with "TEST_"
- All 6 required sheets exist:
- Categories
- Details
- Category Translations
- Detail Label Translations
- Detail Helper Text Translations
- Detail Option Translations
- No production Google Drive URLs remain
- Metadata contains:
dataset_idwith "test-" prefixnamewith "test" in valueversionfield present
- Category names start with "Test Category"
- Field names start with "Test Field"
- Translation sheets are empty (content cleared)
- No production-specific content remains
// In Apps Script editor, set active spreadsheet to test
const testSpreadsheet = SpreadsheetApp.openById('TEST_SPREADSHEET_ID');
SpreadsheetApp.setActiveSpreadsheet(testSpreadsheet);
// Run your tests
generateCoMapeoCategory();
lintAllSheets();
importCategoryFile();- Open the test spreadsheet
- Run all plugin functions:
- Generate CoMapeo Category
- Import category file
- Generate icons
- Manage languages & translate
- Lint sheets
- Verify results
- Check that all operations complete without errors
- Validate output files
- Confirm no production references leak through
- Create test spreadsheet
- Set up bug scenario
- Add specific data that triggers the bug
- Configure edge cases
- Set up test conditions
- Reproduce and debug
- Document findings
- Clean up test spreadsheet
- Always use test spreadsheets for testing
- Give test spreadsheets descriptive names
- Test both success and failure scenarios
- Keep test data generic and non-sensitive
- Verify validation passes before using
- Document what you're testing
- Clean up old test spreadsheets regularly
- Never test on production spreadsheets
- Don't include real project names or data
- Don't share test spreadsheets publicly
- Don't use production Drive URLs in tests
- Don't leave test spreadsheets with production icons
- Don't ignore validation warnings
- Don't use test spreadsheets for real configurations
Test spreadsheets follow this format:
TEST_{YYYYMMDD}_{OriginalSpreadsheetName}
Examples:
TEST_20251102_Wildlife SurveyTEST_20251103_Deforestation MonitoringTEST_20251102_Infrastructure Assessment
Automatic: Test spreadsheets are clearly marked and can be filtered by "TEST_" prefix.
Manual cleanup:
- Go to Google Drive
- Search for
TEST_to find all test spreadsheets - Delete old test spreadsheets (older than 1 week)
- Keep only current test spreadsheet(s)
Programmatic cleanup:
// Clean up test spreadsheets older than 7 days
cleanupTestArtifacts(10080); // 10080 minutes = 7 daysProblem: Test spreadsheet validation reports errors
Solutions:
- Check console logs for specific error details
- Verify all required sheets were created
- Ensure no production URLs remain
- Check metadata fields are properly sanitized
- Re-create test spreadsheet if needed
Problem: "Create Test Spreadsheet for Regression" not in menu
Solutions:
- Refresh the spreadsheet (F5)
- Close and reopen the spreadsheet
- Check that plugin is properly installed
- Verify
onOpen()function runs without errors
Problem: Error "Function createTestSpreadsheetForRegression not found"
Solutions:
- Ensure
regressionTesting.tsis deployed - Check for syntax errors in the file
- Verify function name is correct
- Check Apps Script editor for compilation errors
Problem: Production icon URLs remain in test spreadsheet
Solutions:
- Check validation errors - this should be caught
- Verify placeholder URL is accessible
- Re-run sanitization if needed
- Check console for error messages during copy
This feature (Task 4) enables Task 5 (regression test suite) by providing:
- ✅ Safe test environment
- ✅ Sanitized production-like data
- ✅ Automated validation
- ✅ Consistent test baseline
Task 4: Create Test Spreadsheet
↓
Test spreadsheet ready
↓
Task 5: Build Regression Test Suite
↓
Automated tests run on test spreadsheet
↓
Task 6: Capture Baseline Performance Metrics
You can modify sanitizeRowData() in src/regressionTesting.ts to customize sanitization rules for specific use cases.
// Create multiple test spreadsheets for different scenarios
const scenarios = ['basic', 'complex', 'multilang', 'large'];
scenarios.forEach(scenario => {
const result = duplicateSpreadsheetForTesting();
console.log(`Created test for ${scenario}: ${result.url}`);
// Set up scenario-specific test data
});// Measure performance on test spreadsheet
const start = Date.now();
generateCoMapeoCategory();
const duration = Date.now() - start;
console.log(`Export took ${duration}ms`);- Regression Strategy:
context/process/regression-strategy.md - Next Steps:
NEXT_STEPS.md(Task 4 section) - This guide:
context/process/regression-testing-guide.md
All operations are logged with scope "RegressionTesting". Check Apps Script console for detailed logs.
See Troubleshooting section above.
✅ Task 4 Complete: Test Spreadsheet Creation
The regression testing feature is now fully implemented and integrated. You can safely create test spreadsheets for all future testing needs.
Next Steps:
- Proceed to Task 5: Build regression test suite
- Use test spreadsheets before making any code changes
- Maintain test spreadsheet hygiene
Created: 2025-11-02 Last Updated: 2025-11-02 Status: ✅ Implementation Complete