This repository contains a comprehensive unit testing suite for verifying the output of Osdag modules (Cleat Angle Connection, Fin Plate Connection, and Tension Member Welded). It ensures the computational accuracy of the software by comparing module outputs against validated reference values derived from manual calculations and standard design examples.
(Click the image to watch the demonstration on YouTube)
👉🏻 Click Here for detailed PDF Report
The testing framework utilizes PyTest to drive a data-driven verification process. The core logic involves:
- Input Injection: Reading standard Osdag input files (e.g.,
CleatAngleTest1) containing design parameters. - Module Execution: Invoking the Osdag CLI runner (
osdag.cli.run_module) to process these inputs. - Output Capture: Intercepting the results returned by the module as a Python dictionary.
- Assertion: Comparing specific output keys against expected values defined in external CSV files.
- Test Driver (
test_osdag.py): The main script that orchestrates the tests. It includes aKEY_MAPPINGdictionary to resolve naming inconsistencies between the raw CSV headers (e.g., "Bolt Rows") and the internal Osdag output keys (e.g.,Bolt.Rows). - Reference Data (CSVs): Files like
CleatAngle.csvserve as the "Ground Truth". They map each input file to a set of mandatory checks (e.g., Shear Capacity, Moment Capacity, Efficiency). - Granular Reporting: The suite supports both a high-level file-based check (did the file pass?) and a detailed property-based check (did the specific shear capacity match?).
- Python 3.10+
- PyTest
- Osdag (cloned to
./Osdag)
-
Clone the Osdag Repository:
git clone https://github.com/osdag-org/Osdag.git
Note: Ensure you are on the correct branch compatible with these tests if applicable.
-
Clone this Test Repository:
git clone https://github.com/arry-codes/osdag_unittesting.git
-
Set up the Environment: It is recommended to use a virtual environment.
python3 -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate pip install pytest
Ensure Osdag is in your Python path. If you cloned Osdag into a separate directory, add it to your current folder or
PYTHONPATH.
Executes a consolidated check where each input file counts as one test case.
pytest test_osdag.py::test_consolidated_run
Expands the test suite to verify individual parameters (e.g., weld strength, bolt capacity) separately for each file.
pytest -v test_osdag.py::TestOsdagModules
pytest test_osdag.pyThe tests cover three primary Osdag modules:
| Module | Test Files | Key Checks |
|---|---|---|
| Cleat Angle | 4 Files | Shear Capacity, Moment Capacity, Efficiency, Geometric Checks |
| Fin Plate | 4 Files | Bolt Shear, Plate Bearing, Weld Strength, Block Shear |
| Tension Member | 4 Files | Gross Yielding, Net Rupture, Block Shear Strength |
Each file is verified against expected values from the corresponding CSV files (CleatAngle.csv, FinPlate.csv, etc.).