OpenDataVBB / vdv-453-client

Subscribe to realtime public transport data from a VDV 453/454 API.
ISC License
5 stars 0 forks source link

write tests #1

Open derhuerst opened 2 months ago

derhuerst commented 2 months ago

Currently, there is neither an integration test (testing against fixtures or a mock VDV system) nor an end-to-end test (testing against a real VDV system). Given that the VDV-453/-454 specs are quite complex, we should really have tests to prevent regressions!

dancesWithCycles commented 2 months ago

Hi, I could provide test messages. E.g.:

<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
<DatenAbrufenAntwort>
        <Bestaetigung Zst="2024-06-18T08:59:58.449+02:00" Ergebnis="ok" Fehlernummer="0" />
        <WeitereDaten>false</WeitereDaten>
        <AUSNachricht AboID="1">
                <IstFahrt Zst="2024-06-18T08:59:58.390+02:00">
                        <LinienID>30</LinienID>
                        <RichtungsID>1</RichtungsID>
                        <FahrtRef>
                                <FahrtID>
                                        <FahrtBezeichner>VHP24438-23</FahrtBezeichner>
                                        <Betriebstag>2024-06-18</Betriebstag>
                                </FahrtID>
                                <FahrtStartEnde>
                                        <StartHaltID>de:03252:8000:4:8003</StartHaltID>
                                        <Startzeit>2024-06-18T08:32:00+02:00</Startzeit>
                                        <EndHaltID>de:03252:3690:0:1</EndHaltID>
                                        <Endzeit>2024-06-18T09:07:00+02:00</Endzeit>
                                </FahrtStartEnde>
                        </FahrtRef>
                        <Komplettfahrt>false</Komplettfahrt>
                        <IstHalt>
                                <HaltID>de:03252:3120:1:1</HaltID>
                                <Abfahrtszeit>2024-06-18T08:59:00+02:00</Abfahrtszeit>
                                <IstAbfahrtPrognose>2024-06-18T08:59:55+02:00</IstAbfahrtPrognose>
                                <IstAnkunftPrognose>2024-06-18T08:59:55+02:00</IstAnkunftPrognose>
                                <IstAbfahrtPrognoseStatus>Prognose</IstAbfahrtPrognoseStatus>
                                <IstAnkunftPrognoseStatus>Real</IstAnkunftPrognoseStatus>
                        </IstHalt>
                        <IstHalt>
                                <HaltID>de:03252:3110:0:1</HaltID>
                                <Abfahrtszeit>2024-06-18T09:00:00+02:00</Abfahrtszeit>
                                <IstAbfahrtPrognose>2024-06-18T09:00:55+02:00</IstAbfahrtPrognose>
                                <IstAnkunftPrognose>2024-06-18T09:00:55+02:00</IstAnkunftPrognose>
                                <IstAbfahrtPrognoseStatus>Prognose</IstAbfahrtPrognoseStatus>
                                <IstAnkunftPrognoseStatus>Prognose</IstAnkunftPrognoseStatus>
                        </IstHalt>
                        <LinienText>30</LinienText>
                </IstFahrt>
        </AUSNachricht>
</DatenAbrufenAntwort>

Do you have a test procedure in mind like unit testing where each message type is tested as a unit test?

derhuerst commented 2 months ago

Hey @dancesWithCycles 👋

Do you have a test procedure in mind like unit testing where each message type is tested as a unit test?

I don't think having many per-message-type unit tests will be a good trade-off, given that

However, having ~1 integration test per service that also tests (at least in a shallow way) if the messages get parsed correctly sounds like a good trade-off to me.

I could provide test messages. E.g. [this AUSNachricht one]

These messages will help make vdv-453-client make more compatible with non-VBB systems! 🙌

However, just to make sure: You're talking about a VDV-453 v2.3.2b (although I've seen quite some confusion and handwaving about the versions) & VDV-454 v2.2.1 system?