RIODuino code cannot be tested
Closed this issue · 3 comments
Because RIODuino
is a class rather than an interface, it can't really be easily tested. What do you think about creating an interface and providing the implementation in the hardware
package? Alternatively, we could pass in the I2C
instance and try to mock that up, but it's pretty low-level functionality that would be difficult to mock up and use in a test.
Is a real Arduino of any help via the USB port on the programmer's laptop computer? Or is re-routing functionality from MXP I2C to USB too much of a delta for effective test?
We want to be able to run all of our tests without hardware, on any machine. So in this regard, it is no different than all of our other components.
Plus, we want to be able to test code that uses/depends on the RIODuino
class without actually needing the logic within the class, but instead to "mock" the RIODuino class with custom logic. For example, we might want to test the code that tells the RIODuino to turn on the lights based upon the calculated score (or whatever we have), or to turn the lights blue or red based upon which alliance we're on. For this, we don't need the real RIODuino code, but simply need to mock it to know that the RIODuino's methods are called when they should be called.
Alternatively, we could pass in the I2C instance and try to mock that up, but it's pretty low-level functionality that would be difficult to mock up and use in a test.
I'm currently doing something similar with the DataStream interface using the new serial protocol.