# 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!*