# Megatest Quick Reference
## Run the Right Test Level for Your Needs
## ā” Quick Decision Matrix
| Scenario | Level | Time | Command |
|----------|-------|------|---------|
| **Pre-commit check** | Smoke | 2 min | `pytest tests/megatest/ -m megatest_smoke` |
| **Before PR** | Standard | 10 min | `pytest tests/megatest/ -m megatest_standard` |
| **Weekly validation** | Advanced | 20 min | `pytest tests/megatest/ -m megatest_advanced` |
| **Before minor release** | Integration | 45 min | `pytest tests/megatest/ -m megatest_integration` |
| **Before stable release** | Full Blast | 90 min | `pytest tests/megatest/ -m megatest_full` |
## š Test Levels Explained
### Level 1: Smoke Test (2 minutes) ā”
**Quick & Dirty - Just the essentials!**
```bash
pytest tests/megatest/ -v -m megatest_smoke
```
**What it tests**:
- ā
System initializes (cold start)
- ā
Create 10 simple notes
- ā
Read notes back
- ā
Search works (5 queries)
- ā
Delete works
- ā
No crashes
**What it SKIPS**:
- ā No exports
- ā No imports
- ā No multi-project
- ā No edge cases
- ā No stress testing
**Use when**:
- Quick sanity check
- Pre-commit validation
- Rapid development cycle
- CI fast path
**Output**:
```
š¢ SMOKE TEST: PASSED (2m 15s)
ā
Basic CRUD works
ā
Search works
ā
No crashes
ā
Production data: SAFE
```
---
### Level 2: Standard Test (10 minutes) š§
**Covers core functionality**
```bash
pytest tests/megatest/ -v -m megatest_standard
```
**What it tests**:
- ā
All Level 1 operations
- ā
Create 30 notes (simple + complex)
- ā
Multi-project operations (3 projects)
- ā
All CRUD operations
- ā
Tag operations (add, remove, search)
- ā
Basic search (20 queries)
- ā
Basic edge cases (malformed files)
**What it SKIPS**:
- ā No exports
- ā No imports
- ā No stress testing
- ā Limited edge cases
**Use when**:
- Before creating PR
- Feature development
- Daily validation
- Regression check
**Output**:
```
š¢ STANDARD TEST: PASSED (10m 32s)
ā
Multi-project: 3 projects OK
ā
CRUD: 100/100 operations
ā
Search: 20/20 queries
ā
Tags: All operations OK
ā
Production data: SAFE
```
---
### Level 3: Advanced Test (20 minutes) š
**Advanced features and performance**
```bash
pytest tests/megatest/ -v -m megatest_advanced
```
**What it tests**:
- ā
All Level 2 operations
- ā
Create 60 notes (varied complexity)
- ā
Advanced search (50 queries: boolean, phrases, filters)
- ā
Knowledge graph traversal
- ā
Relationship navigation (depth=3)
- ā
Context building (memory:// URLs)
- ā
Performance metrics (response times)
- ā
Extended edge cases (large files, special chars)
**What it SKIPS**:
- ā No exports (yet)
- ā No imports (yet)
- ā No stress testing
**Use when**:
- Weekly validation
- Performance benchmarking
- Advanced feature development
- Pre-minor-release
**Output**:
```
š¢ ADVANCED TEST: PASSED (20m 18s)
ā
Advanced search: 50/50 queries (avg 42ms)
ā
Knowledge graph: 30 traversals OK
ā
Performance: All within limits
ā
Edge cases: 20/20 handled
ā
Production data: SAFE
```
---
### Level 4: Integration Test (45 minutes) š¦
**Import/Export ecosystem validation**
```bash
pytest tests/megatest/ -v -m megatest_integration
```
**What it tests**:
- ā
All Level 3 operations
- ā
Create 80 notes
- ā
**Export Testing**:
- Docsify basic (validate structure)
- Docsify enhanced (validate plugins)
- HTML export (validate standalone)
- Joplin export (validate metadata)
- Pandoc PDF export
- Pandoc DOCX export
- Archive export (full backup)
- ā
**Import Testing**:
- Obsidian vault import
- Joplin export import
- Notion HTML import
- Evernote ENEX import
- Archive restore
- ā
**Round-trip Testing**:
- Export ā Import ā Verify integrity
**What it SKIPS**:
- ā No Docsify site validation (files only)
- ā No HTML browsing validation
- ā No stress testing
**Use when**:
- Before major releases
- Integration validation
- Data portability testing
- Monthly comprehensive check
**Output**:
```
š¢ INTEGRATION TEST: PASSED (45m 12s)
ā
Exports: 7/7 formats working
⢠Docsify basic: 80 notes exported
⢠Docsify enhanced: Plugins verified
⢠HTML: Standalone site created
⢠Joplin: Metadata preserved
⢠Pandoc PDF: 80 notes ā 45 pages
⢠Pandoc DOCX: All formatting OK
⢠Archive: 2.3MB backup created
ā
Imports: 5/5 sources working
⢠Obsidian: 50 notes imported
⢠Joplin: 40 notes imported
⢠Notion: 30 notes imported
⢠Evernote: 25 notes imported
⢠Archive: 80 notes restored
ā
Round-trip: 100% data integrity
ā
Production data: SAFE
```
---
### Level 5: Full Blast (90 minutes) š„
**Complete system certification**
```bash
pytest tests/megatest/ -v -m megatest_full
```
**What it tests**:
- ā
All Level 4 operations
- ā
Create 100+ notes (all types)
- ā
All edge cases (30 scenarios)
- ā
Stress testing (1000+ operations)
- ā
**Working Docsify Site**:
- Export Docsify enhanced
- Validate index.html structure
- Validate _sidebar.md navigation
- Validate README.md content
- **Start local server (npx docsify serve)**
- **Validate site loads in browser**
- **Validate navigation works**
- **Validate search plugin works**
- **Validate theme toggle works**
- Screenshot success
- ā
**Working HTML Site**:
- Export HTML notes
- Validate index.html
- **Open in browser**
- **Validate all links work**
- **Validate images display**
- **Validate tables render**
- Screenshot success
- ā
Long-running operations
- ā
Resource exhaustion
- ā
Concurrent operations
- ā
Complete analysis
**Use when**:
- Before stable releases
- Monthly certification
- Pre-production deployment
- Complete system validation
**Output**:
```
š¢ FULL BLAST: PASSED (90m 45s)
š Comprehensive Results:
ā
Notes: 100+ created, all types
ā
Operations: 1500+ total
ā
Success rate: 98.7%
ā
Crashes: 0
ā
Hangs: 0
ā
Exports: 7/7 formats
⢠Docsify Enhanced: ā
WORKING SITE
- index.html: Valid HTML5
- Sidebar: 100 entries
- Plugins: 6 active (pagination, TOC, theme, etc.)
- Local server: Started on port 3000
- Browser test: ā
PASSED
- Navigation: ā
WORKING
- Search: ā
WORKING
- Theme toggle: ā
WORKING
- Screenshot: saved to artifacts/
⢠HTML Site: ā
WORKING SITE
- index.html: Valid
- 100 note pages generated
- Browser test: ā
PASSED
- All links: ā
WORKING
- Images: ā
DISPLAYED
- Tables: ā
RENDERED
- Screenshot: saved to artifacts/
⢠Other exports: All validated
ā
Imports: 5/5 sources
ā
Round-trip: 100% integrity
ā
Stress test: 1000 ops/min
ā
Edge cases: 30/30 handled
ā
Performance: All within limits
ā
Production data: VERIFIED SAFE
⢠DB checksum: UNCHANGED
⢠MD folder: UNCHANGED
⢠File count: UNCHANGED
š Grade: A+ (System is PRODUCTION READY)
```
---
## šÆ Level Selection Guide
### When to Run Each Level
#### Daily Development
```bash
# After code changes
pytest tests/megatest/ -m megatest_smoke # 2 min
```
#### Before PR
```bash
# Comprehensive pre-PR check
pytest tests/megatest/ -m megatest_standard # 10 min
```
#### Weekly
```bash
# Weekly validation
pytest tests/megatest/ -m megatest_advanced # 20 min
```
#### Before Releases
```bash
# Minor release (v0.x.1)
pytest tests/megatest/ -m megatest_integration # 45 min
# Major release (v1.0.0)
pytest tests/megatest/ -m megatest_full # 90 min
```
---
## šļø Test Organization
### Directory Structure
```
tests/megatest/
āāā __init__.py # Level documentation
āāā conftest.py # Safety fixtures (ALL levels)
ā
āāā level1_smoke/ # 2 minutes ā”
ā āāā test_smoke_crud.py # Basic operations
ā āāā test_smoke_search.py # Basic search
ā
āāā level2_standard/ # 10 minutes š§
ā āāā test_standard_crud.py # All CRUD
ā āāā test_standard_projects.py # Multi-project
ā āāā test_standard_tags.py # Tag operations
ā āāā test_standard_search.py # Standard search
ā
āāā level3_advanced/ # 20 minutes š
ā āāā test_advanced_search.py # Advanced queries
ā āāā test_advanced_graph.py # Knowledge graph
ā āāā test_advanced_context.py # Context building
ā āāā test_advanced_performance.py # Metrics
ā āāā test_advanced_edge_cases.py # Edge cases
ā
āāā level4_integration/ # 45 minutes š¦
ā āāā test_export_docsify.py # Docsify exports
ā āāā test_export_html.py # HTML exports
ā āāā test_export_joplin.py # Joplin exports
ā āāā test_export_pandoc.py # Pandoc exports
ā āāā test_export_archive.py # Archive exports
ā āāā test_import_obsidian.py # Obsidian import
ā āāā test_import_joplin.py # Joplin import
ā āāā test_import_notion.py # Notion import
ā āāā test_import_evernote.py # Evernote import
ā āāā test_import_archive.py # Archive restore
ā āāā test_roundtrip.py # Export ā Import integrity
ā
āāā level5_full/ # 90 minutes š„
ā āāā test_full_stress.py # High volume
ā āāā test_full_edge_cases.py # All edge cases
ā āāā test_full_concurrent.py # Concurrent ops
ā āāā test_full_docsify_site.py # ⨠Working Docsify validation
ā āāā test_full_html_site.py # ⨠Working HTML validation
ā āāā test_full_analysis.py # Final report
ā
āāā shared/ # Shared utilities
ā āāā generators.py # Synthetic data
ā āāā validators.py # Integrity checks
ā āāā metrics.py # Performance tracking
ā āāā reporters.py # Report generation
ā
āāā artifacts/ # Test outputs (gitignored)
āāā screenshots/ # Site screenshots
āāā exports/ # Export test outputs
āāā reports/ # HTML/JSON reports
```
---
## š Example: Level 5 Docsify Site Validation
```python
@pytest.mark.megatest_full
@pytest.mark.timeout(600) # 10 min max
async def test_working_docsify_site(megatest_context, assert_production_safe):
"""
Level 5: Validate a fully functional Docsify site.
Tests that exported Docsify site:
- Has valid HTML structure
- Can be served locally
- Loads in browser
- Navigation works
- Search works
- Plugins active
"""
# SAFETY: Verify test environment
assert_production_safe(megatest_context.test_dir)
# Create test notes
notes = await megatest_context.create_notes(count=50, complexity="varied")
# Export to Docsify (enhanced)
export_path = megatest_context.test_dir / "docsify_export"
result = await megatest_context.export_docsify_enhanced(
export_path=str(export_path),
enable_all_plugins=True
)
# Validate file structure
assert (export_path / "index.html").exists()
assert (export_path / "_sidebar.md").exists()
assert (export_path / "README.md").exists()
# Validate HTML structure
html_content = (export_path / "index.html").read_text()
assert "<!DOCTYPE html>" in html_content
assert "docsify" in html_content.lower()
assert "search" in html_content.lower()
# Validate plugins configured
assert "docsify-pagination" in html_content
assert "docsify-themeable" in html_content
assert "docsify-copy-code" in html_content
# Start local Docsify server
import subprocess
server = subprocess.Popen(
["npx", "-y", "docsify-cli", "serve", str(export_path), "-p", "3000"],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE
)
try:
# Wait for server to start
import time
time.sleep(5)
# Test site loads
import requests
response = requests.get("http://localhost:3000")
assert response.status_code == 200
assert "Docsify" in response.text
# Test navigation works (check sidebar)
assert "sidebar" in response.text.lower()
# Test search endpoint exists
search_response = requests.get("http://localhost:3000/#/?id=search")
assert search_response.status_code == 200
# Take screenshot (if running in headless browser mode)
screenshot_path = take_screenshot("http://localhost:3000",
megatest_context.artifacts_dir / "docsify_working.png")
print(f"ā
Docsify site WORKING: http://localhost:3000")
print(f"ā
Screenshot saved: {screenshot_path}")
finally:
# Stop server
server.terminate()
server.wait(timeout=5)
# FINAL VALIDATION
assert result.success == True
assert result.notes_exported == 50
print("ā
Full Docsify site validation: PASSED")
```
---
## šÆ CI Integration
### Fast CI (Every Push)
```yaml
# .github/workflows/ci.yml
- name: Smoke Test
run: pytest tests/megatest/ -v -m megatest_smoke
timeout-minutes: 5
```
### Nightly CI
```yaml
# .github/workflows/nightly.yml
- name: Standard Test
run: pytest tests/megatest/ -v -m megatest_standard
timeout-minutes: 15
```
### Weekly CI
```yaml
# .github/workflows/weekly.yml
- name: Full Blast Test
run: pytest tests/megatest/ -v -m megatest_full
timeout-minutes: 120
```
### Pre-Release CI
```yaml
# .github/workflows/release.yml
- name: Integration Test
run: pytest tests/megatest/ -v -m megatest_integration
timeout-minutes: 60
```
---
## š Feature Coverage by Level
| Feature | L1 | L2 | L3 | L4 | L5 |
|---------|----|----|----|----|-----|
| **Basic CRUD** | ā
| ā
| ā
| ā
| ā
|
| **Multi-project** | ā | ā
| ā
| ā
| ā
|
| **Tag operations** | ā | ā
| ā
| ā
| ā
|
| **Advanced search** | ā | ā | ā
| ā
| ā
|
| **Knowledge graph** | ā | ā | ā
| ā
| ā
|
| **Export formats** | ā | ā | ā | ā
| ā
|
| **Import formats** | ā | ā | ā | ā
| ā
|
| **Working sites** | ā | ā | ā | ā | ā
|
| **Stress testing** | ā | ā | ā | ā | ā
|
| **Edge cases** | 5 | 10 | 20 | 25 | 30 |
| **Time** | 2m | 10m | 20m | 45m | 90m |
| **Coverage** | 20% | 40% | 60% | 80% | 100% |
---
## š” Tips for Efficient Testing
### During Development
```bash
# Run only what you changed
pytest tests/megatest/level1_smoke/test_smoke_crud.py -v
# Quick feedback loop
pytest tests/megatest/ -m megatest_smoke --maxfail=1
```
### Before Committing
```bash
# Standard validation (10 min)
pytest tests/megatest/ -m megatest_standard
```
### Before Releasing
```bash
# Full validation (90 min)
# Run this on Friday afternoon, review Monday morning
pytest tests/megatest/ -m megatest_full --tb=short --durations=20
```
---
## š Safety Reminder
**ALL LEVELS USE ISOLATED TEST ENVIRONMENT**
No matter which level you run:
- ā
Test data in `/tmp/megatest_*/`
- ā
Separate test database
- ā
Production data PROTECTED
- ā
Checksum verified
- ā
Auto-cleanup after test
**Your production data is safe at EVERY level!** š”ļø
---
## š Summary
### Choose Your Level
**Need speed?** ā Level 1 (2 min)
**Need confidence?** ā Level 2 (10 min)
**Need performance data?** ā Level 3 (20 min)
**Need export/import validation?** ā Level 4 (45 min)
**Need complete certification?** ā Level 5 (90 min)
### Progressive Enhancement
```
L1 ā L2 ā L3 ā L4 ā L5
ā ā ā ā ā
Quick Core Advanced I/O Full
```
Each level builds on the previous, adding more features and coverage.
**Run the level that matches your timeline and needs!** ā”šš„
---
*Quick reference created: October 15, 2025*
*All levels: ISOLATED and SAFE*
*Choose wisely, test confidently!*