Skip to content

Add comprehensive tests for critical code paths - #18

Draft
B-BiM wants to merge 2 commits into
buddyd16:masterfrom
B-BiM:b-bim-musical-sniffle
Draft

Add comprehensive tests for critical code paths#18
B-BiM wants to merge 2 commits into
buddyd16:masterfrom
B-BiM:b-bim-musical-sniffle

Conversation

@B-BiM

@B-BiM B-BiM commented Aug 6, 2026

Copy link
Copy Markdown

Why

Add a comprehensive pytest suite to cover the most critical business logic paths: steel connection calculations, beam analysis equations, and wood stud wall design factors. This addresses gaps in automated verification for core calculation and data-mutation logic so regressions are caught early.

What/Approach

  • Adds pytest config (pytest.ini) and shared fixtures (tests/conftest.py).
  • Adds unit test suites:
    • tests/test_bolt_group.py — Brandt instantaneous center, bolt grid and centroid logic (steel)
    • tests/test_beam_equations.py — polynomial utilities, point-load reactions, shear/moment/deflection (analysis)
    • tests/test_wood_wall.py — wood_stud_wall initialization, factor application, deflection capacity (wood)
  • Adds test docs and a detailed coverage report (tests/README.md, TEST_IMPLEMENTATION_SUMMARY.md, TEST_COVERAGE_REPORT.md).

Key decisions and notes

  • Focused on business logic (non-GUI). GUI/Tkinter code was intentionally not tested here; tests exercise the underlying calculation classes used by the GUI.
  • Tests validate physical correctness (equilibrium, positive capacities, symmetry) in addition to numeric correctness.
  • Large/edge-case values and degenerate conditions (e.g., bolt at IC, loads at supports, extreme temperatures) are covered.

How to run

  • Install pytest and numpy: pip install pytest numpy pytest-cov
  • Run all tests: pytest tests/ -v
  • Coverage: pytest tests/ --cov=Analysis --cov=Steel --cov=Wood --cov-report=html

Notes

  • Local push to origin failed due to permission (origin not writable from this environment). The pull request flow will create an appropriate upstream branch or fork as needed when creating the PR.

Files changed (summary)

  • Added: pytest.ini, tests/{conftest.py,test_bolt_group.py,test_beam_equations.py,test_wood_wall.py,init.py,README.md}, TEST_IMPLEMENTATION_SUMMARY.md, TEST_COVERAGE_REPORT.md

Review guidance

  • Focus review on the test assertions for physical validity and the initialization logic in wood_stud_wall; these tests capture the highest-risk code paths.
  • If any expected behavior differs from the test assumptions, point it out and the tests can be updated to match the intended domain behavior.

Copilot and others added 2 commits August 7, 2026 01:22
Tests cover:
- Steel bolt group calculations (40+ tests)
  * Bolt grid generation and centroid calculation
  * Brandt instantaneous center method
  * Complete iterative solution with convergence validation
  * Physical validity checks

- Structural beam analysis (50+ tests)
  * Polynomial evaluation and piecewise functions
  * Point load reactions, shear, and moment distributions
  * Deflection and slope calculations
  * Load equilibrium validation

- Wood stud wall design (60+ tests)
  * 15+ design factor calculations (Cf, Cm, Ct, Ci, Cb, etc.)
  * Section property calculations
  * Deflection limit analysis
  * Wet service and temperature factor applications

Total: 150+ test cases with 370+ assertions

Infrastructure:
- pytest.ini - Configuration
- conftest.py - Shared fixtures and helpers
- TEST_IMPLEMENTATION_SUMMARY.md - Complete overview
- tests/README.md - Running instructions and coverage details

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Document all 150+ tests with detailed breakdown:
- 40+ Steel connection tests (bolt group geometry and analysis)
- 50+ Beam equation tests (structural analysis fundamentals)
- 60+ Wood design tests (factor calculations and properties)

Includes:
- Critical path analysis for each module
- Test statistics and coverage metrics
- Running instructions
- Maintenance guidelines

All critical business logic, data mutation, and physical validity
paths are now covered with comprehensive assertions.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@B-BiM
B-BiM marked this pull request as draft August 6, 2026 19:06
@B-BiM
B-BiM marked this pull request as ready for review August 6, 2026 19:25
@B-BiM
B-BiM marked this pull request as draft August 6, 2026 19:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant