Files
temp/tests/features/interactive_session_comprehensive.feature
T

61 lines
2.8 KiB
Gherkin

Feature: Comprehensive Interactive Session Functionality
As a developer, I want to test all aspects of the InteractiveSession class,
including its main run loop and error handling, to ensure its robustness.
Scenario: Session handles failure during history loading
Given an interactive session with a corrupted history file
When I try to load the history
Then an InteractiveSessionError should be raised with a message about loading history
Scenario: Session handles failure during history saving
Given an interactive session with a read-only history file
When I try to save the history
Then an InteractiveSessionError should be raised with a message about saving history
Scenario: Session handles failure during message processing
Given an interactive session where the router will fail
When I try to process a message through the session
Then an InteractiveSessionError should be raised with a message about processing a message
Scenario: Session run loop processes user input and commands
Given an interactive session with a mock router
And a sequence of user inputs: "hello", "/exit"
When I run the session's main loop
Then the router should have processed the message "hello"
And the session should have stopped running
Scenario: Session run loop handles verbose mode
Given an interactive session in verbose mode
And a sequence of user inputs: "test verbose", "/exit"
When I run the session's main loop
Then the output should contain "Processing message..."
Scenario: Session run loop handles KeyboardInterrupt gracefully
Given an interactive session
And the user input will raise a KeyboardInterrupt
When I run the session's main loop
Then the output should contain "Interrupted by user."
And the session should have stopped running
Scenario: Session run loop handles generic exceptions gracefully
Given an interactive session where message processing will raise a generic error
And a sequence of user inputs: "cause error", "/exit"
When I run the session's main loop
Then the output should contain "Error: Test processing error"
Scenario: Session run loop handles startup failure
Given an interactive session that will fail to load history on startup
When I try to run the session's main loop
Then an InteractiveSessionError should be raised with a message about running the session
Scenario: Session displays history correctly
Given an interactive session with some history entries
When I display the history
Then the output must contain "You: Hello"
And the output must contain "Agent: Hi there!"
Scenario: Session handles history operations when no file is provided
Given an interactive session without a history file
When I call load_history and save_history
Then no errors should be raised