-
Notifications
You must be signed in to change notification settings - Fork 0
Add simulated Broadlink device for E2E testing #76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
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. |
jodavis
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot Please make these changes.
| [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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
| @@ -7,10 +8,19 @@ namespace AdaptiveRemote.EndtoEndTests.Host; | |||
| /// </summary> | |||
| public sealed class SimulatedEnvironment : ISimulatedEnvironment | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm thinking this could be implemented like
| public sealed class SimulatedEnvironment : ISimulatedEnvironment | |
| public sealed class SimulatedEnvironment : ISimulatedEnvironment | |
| { | |
| public SimulatedEnvironment(SimulatedBroadlinkDeviceBuilder broadlinkBuilder, SimulatedTiVoDeviceBuilder tivoBuilder) | |
| { | |
| // Set the parameters into the properties here | |
| } | |
| } |
Then all these objects can be created via Reqnroll's DI system.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to accept ILoggerFactory in constructor. The environment now creates the builders internally and starts the devices. (7e3b34f)
| /// <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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename to just Port
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll update the documentation to link to actual code files instead of embedding code samples.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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>
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.