Goal
Introduce automated tests to validate OCPP session lifecycle handling,
with a focus on failed and silent-failed sessions.
Manual testing is no longer sufficient as session logic becomes more complex.
Related Issues
Scope
Tests should cover OCPP 1.6 StatusNotification flows related to session
creation, failure detection, and cleanup.
Required Test Scenarios
1. Silent failure detection (Issue #8)
Given
Available → Preparing → Available
Then
- Session is classified as failed
- handle_failed_session() is called
- Failure reason:
PREPARING_ABORTED_BEFORE_CHARGING
2. Valid charging session (negative test)
Given
Available → Preparing → Charging → Available
Then
- Session is NOT classified as failed
- handle_failed_session() is NOT called
3. Faulted session (regression test)
Given
Preparing → Faulted
Then
- Existing fault handling logic remains unchanged
4. Session cleanup
- Session state is removed after Available or Faulted
- No leaks in internal session storage
Implementation Notes
- Use pytest
- No real EVSE or network access
- Mock Engine and FTP dependencies
- Prefer direct async calls to handle_status_notification()
Acceptance Criteria
- All scenarios covered by automated tests
- Tests fail if silent failure detection breaks
- Tests runnable via: pytest
Goal
Introduce automated tests to validate OCPP session lifecycle handling,
with a focus on failed and silent-failed sessions.
Manual testing is no longer sufficient as session logic becomes more complex.
Related Issues
Preparing->Availabletransition (without Charging) as a failed session #8 (Silent failure detection: Preparing → Available without Charging)Scope
Tests should cover OCPP 1.6 StatusNotification flows related to session
creation, failure detection, and cleanup.
Required Test Scenarios
1. Silent failure detection (Issue #8)
Given
Available → Preparing → Available
Then
PREPARING_ABORTED_BEFORE_CHARGING
2. Valid charging session (negative test)
Given
Available → Preparing → Charging → Available
Then
3. Faulted session (regression test)
Given
Preparing → Faulted
Then
4. Session cleanup
Implementation Notes
Acceptance Criteria