Add simulated Broadlink device for E2E testing#76
Conversation
Co-authored-by: jodavis <6740581+jodavis@users.noreply.github.com>
Co-authored-by: jodavis <6740581+jodavis@users.noreply.github.com>
Co-authored-by: jodavis <6740581+jodavis@users.noreply.github.com>
Co-authored-by: jodavis <6740581+jodavis@users.noreply.github.com>
Co-authored-by: jodavis <6740581+jodavis@users.noreply.github.com>
Co-authored-by: jodavis <6740581+jodavis@users.noreply.github.com>
…improve documentation Co-authored-by: jodavis <6740581+jodavis@users.noreply.github.com>
Test Results311 tests +3 305 ✅ +1 1m 8s ⏱️ -44s Results for commit 0146614. ± Comparison against base commit 6854c1d. This pull request removes 3 and adds 5 tests. Note that renamed tests count towards both.♻️ This comment has been updated with latest results. |
| [Then(@"I should see the Broadlink device recorded at least one inbound packet")] | ||
| public void ThenIShouldSeeTheBroadlinkDeviceRecordedAtLeastOneInboundPacket() | ||
| { | ||
| ISimulatedBroadlinkDevice? device = Environment.Broadlink; |
There was a problem hiding this comment.
Ideally there would not be so much logic in the Step implementations themselves. The logic should be in the TestServices assembly, and the step definitions should be about translating and validating steps and parameters. That way if I need to build non-Gherkin tests, all the logic is available.
I'm not sure the best way to handle this. Either the logic could be build directly into the SimulatedBroadlinkDevice itself, or it could be build as extension methods on ISimulatedBroadlinkDevice.
There was a problem hiding this comment.
Moved logic to extension methods in ISimulatedBroadlinkDeviceExtensions.cs - HasRecordedInboundPacketWithIrData(), GetRecordedPacketsDebugString(), GetFirstPacketWithIrData(), and GetFirstMalformedPacket(). Step definitions now just call these methods. (7e3b34f)
test/AdaptiveRemote.EndtoEndTests.TestServices/Host/ISimulatedEnvironment.cs
Outdated
Show resolved
Hide resolved
test/AdaptiveRemote.EndtoEndTests.TestServices/Host/SimulatedEnvironment.cs
Show resolved
Hide resolved
| /// <summary> | ||
| /// Gets the actual UDP port the device is bound to (useful when using ephemeral ports). | ||
| /// </summary> | ||
| int BoundPort { get; } |
There was a problem hiding this comment.
I see, there is already a Port property because this extends ISimulatedDevice. I wonder what this is for..
There was a problem hiding this comment.
Removed BoundPort property. Since ISimulatedBroadlinkDevice extends ISimulatedTiVoDevice (formerly ISimulatedDevice), it inherits the Port property which serves the same purpose. (7e3b34f)
...ptiveRemote.EndtoEndTests.TestServices/SimulatedBroadlink/SimulatedBroadlinkDeviceBuilder.cs
Outdated
Show resolved
Hide resolved
...ptiveRemote.EndtoEndTests.TestServices/SimulatedBroadlink/SimulatedBroadlinkDeviceBuilder.cs
Show resolved
Hide resolved
|
|
||
| ### Core Interfaces | ||
|
|
||
| ```csharp |
There was a problem hiding this comment.
Instead of including all these code samples, just link to the actual code. That way the documentation won't get out of date.
There was a problem hiding this comment.
In general, the documentation should be adding information that's not easily understood from the code. Links to code files can be provided where seeing the code would help with understanding.
There was a problem hiding this comment.
I'll update the documentation to link to actual code files instead of embedding code samples.
There was a problem hiding this comment.
Updated documentation to link to actual code files instead of embedding samples. Removed all code blocks and replaced with links to implementation files. Added references to test steps, features, and protocol implementation. (0146614)
- Move test logic from BroadlinkSteps to extension methods in TestServices - Remove registration methods from ISimulatedEnvironment (use constructor injection) - Rename ISimulatedDevice to ISimulatedTiVoDevice for clarity - Remove BoundPort property (use Port from base interface) - Update builders to accept ILoggerFactory instead of ILogger - Remove WithPort customization (always use ephemeral ports) - Simplify SimulatedEnvironment to construct devices directly Co-authored-by: jodavis <6740581+jodavis@users.noreply.github.com>
Replace code samples with links to actual implementation files in _doc_SimulatedDevices.md Co-authored-by: jodavis <6740581+jodavis@users.noreply.github.com>
|
|
||
| RecordedPacket? irPacket = device.GetFirstPacketWithIrData(); | ||
|
|
||
| if (irPacket == null) |
Implementation Plan: Simulated Broadlink Device for E2E Testing
Based on the specification in
_spec_SimulatedBroadlinkDevice.md, I implemented a simulated Broadlink device following the existing SimulatedTiVo pattern.Implementation Checklist
Final Status
✅ All requirements met:
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.