-
Notifications
You must be signed in to change notification settings - Fork 0
Add automated tests for OCPP session failure detection #15
Copy link
Copy link
Open
Labels
mvpMVP scopeMVP scopequalityCode quality and test coverageCode quality and test coveragetestsAutomated testsAutomated tests
Description
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
- Related to Treat
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
- 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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
mvpMVP scopeMVP scopequalityCode quality and test coverageCode quality and test coveragetestsAutomated testsAutomated tests
Type
Projects
Status
In progress