This project follows MVP-level testing as defined in /Users/bhunt/.claude/CLAUDE.md:
- 2-5 basic tests per feature
- Avoid enterprise complexity
- Focus on core functionality
- Use Python's built-in unittest (no pytest)
Total Tests: 21
Test Files: 5
Execution Time: 0.006 seconds
Pass Rate: 100%
Framework: unittest (built-in)
Module: /Users/bhunt/development/claude/binary/src/binary_basics.py
test_decimal_to_binary_conversion- Converts decimal to binary (0, 42, 255)test_binary_to_decimal_conversion- Converts binary to decimaltest_binary_addition- Binary addition with carry propagationtest_bitwise_operations- AND, OR, XOR, NOT operationstest_twos_complement_conversion- Two's complement for negative numbers
Module: /Users/bhunt/development/claude/binary/src/logic_gates.py
test_and_gate- AND gate truth table (2 and 3 inputs)test_or_gate- OR gate truth tabletest_not_gate- NOT gate inversiontest_xor_gate- XOR gate (exclusive OR)test_gate_composition- Chaining gates together
Module: /Users/bhunt/development/claude/binary/src/truth_tables.py
test_expression_parsing- Parse boolean expressionstest_truth_table_generation- Generate complete truth tablestest_student_table_validation- Validate student submissionstest_table_formatting- ASCII table formatting
Module: /Users/bhunt/development/claude/binary/src/practice_generator.py
test_problem_generation- Generate problems for all difficultiestest_hint_system- Progressive 3-level hint systemtest_answer_validation- Validate answers and provide feedbacktest_adaptive_difficulty- Adjust difficulty based on performance
Module: /Users/bhunt/development/claude/binary/src/interactive_tutor.py
test_session_management- Create, save, and load sessionstest_lesson_state_tracking- Track progress and streakstest_progress_calculation- Calculate accuracy and duration
# Run all tests (recommended)
python3 run_tests.py
# Quick mode (less verbose)
python3 run_tests.py quick
# Run specific module
python3 run_tests.py binary
python3 run_tests.py gates
python3 run_tests.py truth
python3 run_tests.py practice
python3 run_tests.py tutor
# Show help
python3 run_tests.py help# Using unittest directly
python3 -m unittest discover -s tests -p "test_*.py" -v
# Run single test file
python3 -m unittest tests.test_binary_basics -v
# Run specific test case
python3 -m unittest tests.test_binary_basics.TestBinaryBasics.test_decimal_to_binary_conversion -v- 2-5 tests per module (not 50+ tests per module)
- Focus on core functionality (not edge cases)
- Test real code (no complex mocking)
- Uses Python's unittest (no external dependencies)
- Simple setUp/tearDown (minimal fixtures)
- Clear assertion methods (assertEqual, assertTrue, etc.)
- All tests run in < 0.01 seconds
- No network calls or external dependencies
- Reproducible results every time
- Test names describe what's being tested
- One test per behavior
- Minimal comments (code is self-documenting)
✅ Binary conversion algorithms ✅ Binary arithmetic (addition) ✅ Logic gate operations (AND, OR, NOT, XOR) ✅ Gate composition ✅ Truth table generation ✅ Expression parsing ✅ Practice problem generation ✅ Hint delivery system ✅ Answer validation ✅ Session persistence ✅ Progress tracking
Following MVP principles, we intentionally skip:
❌ Exhaustive edge cases (e.g., all possible bit widths) ❌ Error message formatting ❌ Performance benchmarks ❌ UI/UX interactions beyond core logic ❌ Advanced features (subtraction, multiplication, NAND, NOR, XNOR) ❌ Internationalization ❌ Browser/platform compatibility
These can be added in production if needed, but aren't required for MVP validation.
import unittest
from module_name import ClassName
class TestFeature(unittest.TestCase):
"""Test core feature functionality"""
def setUp(self):
"""Minimal setup - only what's needed"""
self.instance = ClassName()
def test_basic_behavior(self):
"""Test one specific behavior"""
result = self.instance.method()
self.assertEqual(result, expected_value)All essential features have test coverage:
- Binary conversions (both directions)
- Logic gates (basic operations)
- Truth table generation
- Practice problems
- Session management
Advanced features tested only at basic level:
- Two's complement (basic test only)
- Multi-input gates (2-3 inputs tested)
- Expression parsing (simple expressions only)
This is intentional for MVP. Core workflows are validated without over-engineering.
✅ All 21 tests passing ✅ Execution time < 0.01 seconds ✅ Zero external dependencies ✅ 100% core feature coverage ✅ Clear, maintainable code
- New module created → Add 2-5 tests
- Bug fix → Add 1 test to prevent regression
- Feature request → Add 2-3 tests for new behavior
- Minor refactoring (tests still pass)
- Documentation changes
- Code formatting
- Comment updates
# tests/test_new_feature.py
import unittest
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).parent.parent / 'src'))
from new_feature import NewFeature
class TestNewFeature(unittest.TestCase):
"""Test new feature functionality"""
def setUp(self):
self.feature = NewFeature()
def test_core_behavior_1(self):
"""Test primary use case"""
result = self.feature.main_method()
self.assertIsNotNone(result)
def test_core_behavior_2(self):
"""Test secondary use case"""
result = self.feature.another_method()
self.assertTrue(result)
if __name__ == '__main__':
unittest.main()Tests are designed to run in any environment:
# Simple CI check
python3 run_tests.py quick && echo "✅ Tests passed" || exit 1
# With coverage (if needed later)
python3 -m coverage run -m unittest discover -s tests
python3 -m coverage reportProblem: Module not found Solution: Add src to Python path
sys.path.insert(0, str(Path(__file__).parent.parent / 'src'))Problem: Tests don't run Solution: Check naming
- Test files must start with
test_ - Test methods must start with
test_ - Must be in
tests/directory
Problem: Test fails unexpectedly Solution: Read error message
- Shows expected vs actual values
- Points to exact line number
- Check setUp() method
tests/
├── __init__.py # Package marker
├── README.md # Detailed documentation
├── QUICKSTART.md # Quick reference
├── test_binary_basics.py # 5 tests
├── test_logic_gates.py # 5 tests
├── test_truth_tables.py # 4 tests
├── test_practice_generator.py # 4 tests
└── test_interactive_tutor.py # 3 tests
File: /Users/bhunt/development/claude/binary/run_tests.py
Features:
- Run all tests or specific modules
- Verbose or quiet output
- Clear success/failure messages
- Help system built-in
- This file: Comprehensive testing documentation
- tests/README.md: Test suite overview
- tests/QUICKSTART.md: Quick reference card
- TEST_SUMMARY.md: Detailed test breakdown
Last Run: 2025-10-15 Result: ✅ All 21 tests passing Time: 0.006 seconds Framework: unittest (Python 3.x)
"MVP-level testing means testing the right things, not testing everything."
- CLAUDE.md
This test suite validates core functionality without the complexity of enterprise testing. It's fast, focused, and sufficient for MVP deployment while remaining easy to extend for production needs.
| Task | Command |
|---|---|
| Run all tests | python3 run_tests.py |
| Quick mode | python3 run_tests.py quick |
| Specific module | python3 run_tests.py [module] |
| Using unittest | python3 -m unittest discover -s tests -v |
| Single file | python3 -m unittest tests.test_binary_basics -v |
| Show help | python3 run_tests.py help |
Testing Level: MVP (2-5 tests per feature) Status: ✅ Production Ready Maintenance: Low (simple, focused tests)