Testing

Debug With Assert
Debug With Assert
This document covers debugging Python programs using assert statements including assertion syntax, sanity checks, precondition validation, and best practices for catching bugs early in development. Proactive bug detection technique.
Working with Someone Else's Code
Working with Someone Else's Code
This document covers strategies for understanding and fixing problems in code written by others, including reading comments and tests, navigating large codebases, and practicing with open-source projects. Essential skills for maintaining unfamiliar code.
Component Testing
Component Testing
This document explains the principles, approaches, and tools for testing React components, including unit and end-to-end testing, Arrange-Act-Assert, and libraries like Jest and React Testing Library.
Web Application
Web Application
This document outlines the phases of the application development lifecycle from requirements gathering to maintenance, and highlights best practices for organizing code in web applications.
Why don't Developers want to test?
Why don't Developers want to test?
This document explores common reasons developers avoid testing, the risks of skipping tests, and the long-term benefits of maintaining a robust test suite for code reliability and collaboration.
Testing Guide
Testing Guide
SCSS Styling System - Complete Testing Guide This script shows you exactly how to test the styling integration cat « ‘EOF’ ╔═══════════════════════════════════════════════════════════════════════════════╗ ║ ║ ║ SCSS STYLING SYSTEM - COMPLETE TESTING GUIDE ║ ║ ║ ╚═══════════════════════════════════════════════════════════════════════════════╝ 📋 TESTING LEVELS ═══════════════════════════════════════════════════════════════════════════════ Level 1: Unit Testing (Automated) ✓ Verify CSS files exist and compile ✓ Test CSS caching mechanism ✓ Test course detection from metadata ✓ Run: npm run test:anki Level 2: Integration Testing (Automated + Manual) ✓ Generate test APKGs with CSS ✓ Verify CSS embedded in APKG ✓ Test course-specific vs default CSS ✓ Run: npm run test:anki:verbose
Testing Quick Reference
Testing Quick Reference
SCSS Styling System - Quick Reference Guide 🚀 Quick Start Testing (5 minutes) 1. Verify Tests Pass 1npm run test:anki ✅ Expected: 52 tests passing 2. Verify CSS Files Exist 1npm run anki:styles:list ✅ Expected: psychology.css (16 KB), devops.css (17 KB) 3. Generate Test APKG from Real Data 1conda activate ags-anki 2 3python3 << 'PYTHON' 4import json 5from pathlib import Path 6from scripts.anki.apkg_generator import APKGGenerator 7import tempfile, shutil 8 9# Load real psychology data 10with open("data/course/psychology-l2/01/01m/001/anki/01-counselling-skills.json") as f: 11 data = json.load(f) 12 13# Ensure course metadata exists 14if 'course' not in data['metadata']: 15 data['metadata']['course'] = 'psychology' 16 17# Generate APKG with styling 18with tempfile.TemporaryDirectory() as tmpdir: 19 gen = APKGGenerator(verbose=True) 20 apkg = gen.generate_from_data(data, tmpdir, data['metadata'].get('deck_name')) 21 22 # Copy to Desktop 23 shutil.copy(apkg, Path.home() / "Desktop" / "psychology-real-data.apkg") 24 print(f\n✅ APKG copied to ~/Desktop/psychology-real-data.apkg") 25 26 print(f" Size: {apkg.stat().st_size / 1024:.1f} KB (includes psychology CSS)") 27PYTHON ✅ Expected:
Testing Verification
Testing Verification
testing verification placeholder #!/bin/bash Quick test to verify CSS is in APKG SQLite database cat « ‘EOF’ ╔═══════════════════════════════════════════════════════════════════════════════╗ ║ ║ ║ HOW TO VERIFY CSS IS EMBEDDED IN YOUR APKG FILES ║ ║ ║ ╚═══════════════════════════════════════════════════════════════════════════════╝ FILES TO TEST WITH ════════════════════════════════════════════════════════════════════════════════ Run this command to generate test APKGs: python3 « ‘PYTHON’ import json import tempfile from pathlib import Path from scripts.anki.apkg_generator import APKGGenerator Psychology APKG psy_data = { “metadata”: {“course”: “psychology”, “deck_name”: “Psy-Test”, “unit”: “U1”, “module”: “M1”}, “flashcards”: [{“id”: “1”, “question”: “Q?”, “answer”: “A”, “tags”: [“test”], “difficulty”: 1}] }