Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 27, 2026

E2E tests currently use NullCommandService which no-ops all TiVo commands, preventing validation of protocol-level interactions.

Implementation

SimulatedTiVoDevice - TCP server on loopback implementing TiVo line-based ASCII protocol:

  • Messages terminated with \r (not standard \n), requiring custom ReadLineAsync implementation
  • Thread-safe message recording with ConcurrentBag<RecordedMessage>
  • Ephemeral ports (0) enable parallel test execution without conflicts

SimulatedEnvironment - Device lifecycle manager with builder pattern:

ISimulatedDeviceBuilder builder = new SimulatedTiVoDeviceBuilder(logger);
simulatedEnvironment.RegisterDevice("TiVo", builder);
ISimulatedDevice device = simulatedEnvironment.StartDevice("TiVo");
// Port is available, messages recorded with timestamps

Test integration - Simulated TiVo device available for all tests:

  • BeforeScenario (Order=50): Start simulated device on ephemeral port for all scenarios
  • BeforeScenario (Order=200): Pass --tivo:IP=127.0.0.1:{port} to host
  • Test step validates exact protocol message format: IRCODE PLAY
  • ISimulatedEnvironment accessible as property in StepsBase

Architecture

  • Interface naming: All interfaces use ISimulated* prefix for clarity (ISimulatedEnvironment, ISimulatedDevice, ISimulatedDeviceBuilder)
  • Universal availability: Simulated TiVo device automatically starts for all test scenarios, not just specific tagged tests
  • Simplified access: StepsBase provides direct property access to ISimulatedEnvironment without helper methods

Result

Protocol validation replaces no-op behavior. Messages like IRCODE PLAY\r are captured with timestamps and verified in assertions. 2/2 E2E tests passing. Simulated device is now standard test infrastructure available to all scenarios.

Original prompt

This section details on the original issue you should resolve

<issue_title>Implement a Simulated TiVo device for E2E testing</issue_title>
<issue_description>Is your feature request related to a problem? Please describe.
End to End tests currently use a NullCommandService for TiVo commands, which handles command buttons but no-ops the responses, so that none of the TiVo service can be tested.

Describe the solution you'd like
See the spec definition at test/AdaptiveRemote.EndtoEndTests.TestServices/_spec_SimulatedTiVoDevice.md
</issue_description>

<agent_instructions>Implement the spec as described in the _spec_SimulatedTiVoDevice.md document. When the implementation is complete, make sure the entire project builds with '/warnaserror' with no warnings or errors, and that the headless E2E test passes. When you are done, replace the _spec_SimulatedTiVoDevice.md document with a _doc_SimulatedTiVoDevice.md that describes the final implementation.</agent_instructions>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 5 commits January 27, 2026 19:01
Co-authored-by: jodavis <6740581+jodavis@users.noreply.github.com>
Co-authored-by: jodavis <6740581+jodavis@users.noreply.github.com>
… test

Co-authored-by: jodavis <6740581+jodavis@users.noreply.github.com>
Co-authored-by: jodavis <6740581+jodavis@users.noreply.github.com>
…and message matching

Co-authored-by: jodavis <6740581+jodavis@users.noreply.github.com>
Copilot AI changed the title [WIP] Implement simulated TiVo device for E2E testing ADR-120: Implement simulated TiVo device for protocol-level E2E testing Jan 27, 2026
Copilot AI requested a review from jodavis January 27, 2026 19:19
@github-actions
Copy link

github-actions bot commented Jan 27, 2026

Test Results

308 tests  +3   304 ✅ +1   51s ⏱️ -2s
  5 suites ±0     4 💤 +2 
  5 files   ±0     0 ❌ ±0 

Results for commit 61d38c9. ± Comparison against base commit b1e7759.

This pull request removes 3 and adds 5 tests. Note that renamed tests count towards both.
,False)
AdaptiveRemote.Services.ProgrammaticSettings.PersistSettingsTests ‑ PersistSettings_Set_ValidatesKeyNameAsync (Hello
AdaptiveRemote.Services.ProgrammaticSettings.PersistSettingsTests ‑ PersistSettings_Set_ValidatesValueAsync (Invalid
AdaptiveRemote.EndToEndTests.ConsoleHost.Features.TiVoDeviceIntegrationFeature ‑ TiVo receives Play command
AdaptiveRemote.EndToEndTests.HeadlessHost.Features.TiVoDeviceIntegrationFeature ‑ TiVo receives Play command
AdaptiveRemote.EndToEndTests.WpfHost.Features.TiVoDeviceIntegrationFeature ‑ TiVo receives Play command
AdaptiveRemote.Services.ProgrammaticSettings.PersistSettingsTests ‑ PersistSettings_Set_ValidatesKeyNameAsync (Hello
,False)
AdaptiveRemote.Services.ProgrammaticSettings.PersistSettingsTests ‑ PersistSettings_Set_ValidatesValueAsync (Invalid
,False)

♻️ This comment has been updated with latest results.

@jodavis jodavis marked this pull request as ready for review January 28, 2026 05:06
@jodavis
Copy link
Owner

jodavis commented Jan 28, 2026

@copilot address code review feedback. Make sure the project still builds clean and the headless E2E tests still pass after changes are made.

…e Ready state step to HostSteps, make simulated TiVo available for all tests

Co-authored-by: jodavis <6740581+jodavis@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 28, 2026

@copilot address code review feedback. Make sure the project still builds clean and the headless E2E tests still pass after changes are made.

Verified that all code review feedback has been addressed in commit 66a718d.

✅ Project builds cleanly with /warnaserror (0 warnings, 0 errors)
✅ All headless E2E tests pass (2/2 tests passing)

All changes from the previous review feedback are working correctly:

  • Renamed ITest* → ISimulated* interfaces
  • Removed GetContainerObjectOrDefault, added ISimulatedEnvironment property
  • Moved "Ready state" step to HostSteps
  • Simplified logger approach
  • Simulated TiVo device now available for all tests

@jodavis jodavis merged commit 29d7df1 into main Jan 28, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement a Simulated TiVo device for E2E testing

3 participants