opentripplanner / OpenTripPlanner

An open source multi-modal trip planner
http://www.opentripplanner.org
Other
2.13k stars 1.01k forks source link

Introduce module tests for GTFS-RT #5871

Closed leonardehrenfried closed 1 month ago

leonardehrenfried commented 1 month ago

Summary

As discussed in the realtime working group meeting, this introduces module tests for the GTFS-RT realtime code. They are ports of the existing tests but have been converted to use @habrahamsson-skanetrafiken's test environment code. This results in faster test execution and a less confusing debugging experience.

To make this possible, I extracted the bulk of the test environment into a base class which is subclassed by both the Siri and GTFS-RT test to add a few specific methods.

Unit tests

Well... yes.

Documentation

Javadoc for each test case.

codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 68.54%. Comparing base (f535524) to head (410284c).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## dev-2.x #5871 +/- ## ============================================= + Coverage 68.51% 68.54% +0.02% - Complexity 16725 16732 +7 ============================================= Files 1918 1918 Lines 72734 72734 Branches 7456 7456 ============================================= + Hits 49834 49854 +20 + Misses 20329 20310 -19 + Partials 2571 2570 -1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

habrahamsson-skanetrafiken commented 1 month ago

@leonardehrenfried I think the idea looks good! But in general I would prefer composition in favor of inheritance. Specifically if we ever want to test gtfs and siri together it would get clunky with an abstract base class.

leonardehrenfried commented 1 month ago

@habrahamsson-skanetrafiken I've changed the inheritance to composition. It's not super-elegant either but less bad than some other options. My intention is for the split between Siri and GTFS test environment to become unnecessary once I've extracted a common timetable snapshot manager.