Skip to content

About

This repository contains unit tests for verifying the output of Osdag modules

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Developing unit tests for Osdag using PyTest

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.

Demo Video

Watch the Osdag Unit Testing Demo

(Click the image to watch the demonstration on YouTube)

Report

👉🏻 Click Here for detailed PDF Report

Technical Implementation

Methodology

The testing framework utilizes PyTest to drive a data-driven verification process. The core logic involves:

  1. Input Injection: Reading standard Osdag input files (e.g., CleatAngleTest1) containing design parameters.
  2. Module Execution: Invoking the Osdag CLI runner (osdag.cli.run_module) to process these inputs.
  3. Output Capture: Intercepting the results returned by the module as a Python dictionary.
  4. Assertion: Comparing specific output keys against expected values defined in external CSV files.

Key Components

  • Test Driver (test_osdag.py): The main script that orchestrates the tests. It includes a KEY_MAPPING dictionary 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.csv serve 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?).

Requirements

  • Python 3.10+
  • PyTest
  • Osdag (cloned to ./Osdag)

Installation & Setup

  1. 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.

  2. Clone this Test Repository:

    git clone https://github.com/arry-codes/osdag_unittesting.git
  3. 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.

Running Tests

Summary Run (12 File-based Checks)

Executes a consolidated check where each input file counts as one test case.

pytest test_osdag.py::test_consolidated_run
image

Detailed Run (48 Granular Checks)

Expands the test suite to verify individual parameters (e.g., weld strength, bolt capacity) separately for each file.

pytest -v test_osdag.py::TestOsdagModules
image

All Tests

pytest test_osdag.py

Test Cases Coverage

The 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.).

About

This repository contains unit tests for verifying the output of Osdag modules

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages