Lemontropia-Suite/TESTING_AND_DEBUGGING.md

25 lines
1.4 KiB
Markdown

# Testing & Debugging Protocols
## 1. Automated Testing Strategy
You are required to maintain a `tests/` directory. Use **pytest** for unit logic and **pytest-qt** for UI interactions.
### A. Core Logic Validation
- **Requirement:** Every math formula in `GAME_MECHANICS.md` must have a corresponding unit test in `tests/test_math.py`.
- **Edge Cases:** Test for 0.00 PED loot, maximum stack sizes, and 100% item decay.
### B. Log Parsing Verification
- **Mocking:** Do not rely on real game logs for testing. Create a `tests/mock_logs/` folder containing sample `chat.log` snippets.
- **Goal:** The `LogWatcher` must correctly identify loots, globals, and damage values from these mocks with 100% accuracy.
## 2. Debugging Routine
When a bug is reported or a test fails, follow the **"Plan-Act-Reflect"** pattern:
1. **Hypothesize:** Use **Sequential Thinking** to identify the most likely failure point.
2. **Trace:** Use the **Filesystem** tool to read the latest `logs/debug.log` file.
3. **Isolate:** Create a minimal reproduction script to confirm the bug.
4. **Fix:** Apply the fix and run all existing tests to ensure no regressions.
## 3. Playwright UI Testing
Use the **Playwright MCP** to:
- Verify that the HUD overlay remains "Always on Top."
- Test button clicks and navigation between the Hunter and Miner modules.
- Ensure that "Project Selection" correctly loads historical data into the dashboard.