Skip to content

Validator (PlateGirderBridge) File Test#143

Open
ManavSharma23 wants to merge 13 commits into
Aditya-Donde:testfrom
ManavSharma23:plategirder-tests
Open

Validator (PlateGirderBridge) File Test#143
ManavSharma23 wants to merge 13 commits into
Aditya-Donde:testfrom
ManavSharma23:plategirder-tests

Conversation

@ManavSharma23

Copy link
Copy Markdown

## Summary

This PR adds a detailed pytest suite for the plate girder bridge input workflow and a custom pytest reporting helper.

The main test file, tools/test_plategirderbridge.py, focuses on validating how BridgeInputValidator and PlateGirderBridge handle user-provided bridge design inputs. It checks both simple field-level validation and more complex relationships between inputs, so that invalid bridge configurations are caught early and valid boundary cases continue to pass.

The supporting file, tools/conftest.py, adds a custom terminal summary for these tests. Since many of the tests are heavily parameterized, the summary formats each case into readable input/expected-output lines and shows failure reasons in a clearer way.

## What tools/test_plategirderbridge.py Does

This file adds automated tests for the plate girder bridge validation layer. It creates reusable valid input fixtures, modifies one field at a time, and checks whether the validator accepts or rejects the input correctly.

It tests the basic input fields used to define the bridge setup, including:

  • span
  • carriageway width
  • median selection
  • skew angle
  • footpath selection
  • structure type
  • project location
  • design mode
  • girder selection
  • cross bracing
  • end diaphragm
  • deck concrete grade

It also tests the additional plate girder design fields used after the basic bridge configuration is selected, including:

  • overall bridge width
  • transverse girder spacing
  • number of girders
  • deck overhang
  • deck thickness
  • footpath width and thickness
  • crash barrier width, height, load, and post spacing
  • median width, height, load, and post spacing
  • railing height, width, and load value
  • wearing course density and thickness
  • wearing course lane table count and lane table data
  • plate girder self-weight factor
  • live load eccentricity
  • live load footpath pressure mode and value
  • seismic importance factor, time period, damping, dead load value, and live load value
  • wind load average exposed height, gust factor, drag coefficients, lift coefficient, exposed area values, and eccentricity values
  • thermal coefficients for steel and RCC
  • deck slab reinforcement bounds and clear cover values
  • shear stud yield strength, ultimate strength, diameter, height, count, and transverse spacing
  • design partial safety factors
  • fatigue load cycles
  • deflection limits

## Validation Behavior Covered

The tests are written to cover a wide range of real validation situations, not just a single happy path.

They check that the validator behaves correctly for:

  • negative values
  • zero values
  • values below minimum limits
  • values above maximum limits
  • exact minimum and maximum boundary values
  • values just below and just above limits
  • normal valid engineering values
  • numeric strings that should still be accepted
  • non-numeric strings
  • empty strings
  • None
  • lists and dictionaries passed where scalar values are expected
  • malformed lane table rows
  • empty lane table data
  • lane table values near tolerance limits
  • unknown keys
  • typo keys
  • fields that currently pass silently because the validator does not enforce a bound

This gives the validation layer regression coverage across both expected user input and incorrect input shapes.

## Cross-Field Rules Covered

A major part of this test file is focused on rules where one field cannot be validated correctly without looking at another field.

The tests cover cases such as:

  • carriageway width changing its valid range depending on whether a median is included
  • span and carriageway width producing independent or combined validation errors
  • girder count depending on overall bridge width
  • girder spacing depending on overall bridge width
  • deck overhang depending on overall bridge width
  • crash barrier, median, and railing widths being checked against overall width
  • crash barrier and median post spacing being checked against bridge span
  • footpath width behavior changing for no footpath, single-side footpath, and both-side footpath configurations
  • shear stud height depending on stud diameter and deck thickness
  • stud count depending on stud diameter and girder top flange width
  • stud transverse spacing depending on stud diameter, stud count, and flange width
  • larger stud diameters invalidating previously valid stud count or spacing values
  • reduced overall width shrinking the allowed girder-count range

These tests help protect the engineering assumptions in the input workflow, where many values are only meaningful when evaluated together.

## PlateGirderBridge Input Handling

The suite also tests behavior on the PlateGirderBridge object itself.

It checks that:

  • set_input() can accept valid basic and additional input dictionaries
  • calling set_input() repeatedly remains stable
  • passing an empty dictionary does not crash
  • basic input extraction contains only basic input keys
  • additional input extraction does not include basic input keys
  • validation errors are returned in the expected structure
  • collected error messages are non-empty strings

This confirms that the bridge object organizes and exposes input data in a predictable way before later design or analysis stages use it.

## What tools/conftest.py Does

tools/conftest.py adds custom pytest reporting specifically for this large parameterized validation suite.

It uses pytest hooks to:

  • reset collected bridge test results at the start of a run
  • capture each test result after execution
  • extract the test name
  • extract parameter values from parameterized test IDs
  • record whether each case passed or failed
  • capture a short failure reason for failed assertions
  • group results by test function
  • print a detailed terminal summary at the end of the pytest run

The summary includes readable labels for many parameterized tests, such as the tested value, dependent values, and whether the case was expected to be valid or invalid. This makes failures much easier to interpret than raw pytest parameter IDs.

## Why This Is Useful

The plate girder bridge workflow depends on a large number of engineering inputs. Many of these inputs have strict numeric limits, while others depend on related fields like span, overall width, flange width, stud diameter, median selection, or footpath configuration.

This PR makes that behavior explicit and testable.

It helps ensure that:

  • valid bridge input configurations are accepted
  • invalid configurations are rejected
  • boundary values behave consistently
  • cross-dependent engineering rules do not regress
  • validator error structures remain predictable
  • future edits to validation logic can be checked quickly
  • failures in large parameterized tables are easier to debug

## Testing

This PR adds:

  • tools/test_plategirderbridge.py
  • tools/conftest.py

tools/test_plategirderbridge.py contains 104 test functions, many of which are parameterized to cover a much larger number of individual validation cases.****

Aditya-Donde and others added 13 commits June 10, 2026 05:30
…d cases

- Port create_seismic_load_cases() (EQ_X/EQ_Z/EQ_Y + 1.5 EQ (a/b/c) per
  Cl.218.3) with tributary-area nodal distribution, replacing the old
  UI-pressure patch load create_seismic_load()
- Derive total DL by integrating the registered DL + DW load cases
  (_load_case_resultant_kN) instead of a per-method accumulator
- Governing-LL weight from IRC vehicle geometry (unit-fixed N -> kN)
- Sa/g fallback from the Cl.218.5.1 spectral curve (soil type + T)
- add_seismic_loads() reads KEY_SL_* seismic tab keys and weather_data
  z_value; runs after create_governing_ll_load_case() in design()
@Aditya-Donde Aditya-Donde force-pushed the test branch 3 times, most recently from b48cfb4 to f2f2f98 Compare June 14, 2026 11:26
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.

4 participants