Tests describe the behaviour of a driver and can be used to help with development. They are also useful in describing the intended usage of a driver.
For example usage, see:

Checking Values

The Engine test framework uses rspec-expectations for verifying status variables and command results returned expected values.

Helper Functions

transmit / responds
string / hex string / byte array
emulates a device sending data to the module
function_name, *arguments
calls the function requested on the module with the arguments provided
string / hex string / byte array
this is the data the driver is expected to send to the device
provides access to the result of the last executed request
provides access to the current status of the driver
emulates a connection drop followed by re-establishment
emulates a connection drop where communications have failed to be re-established
emulates connection re-establishment. Should only be called after a device_offline
times = 1
resumes the test after the specified number of ticks through the event loop
resumes the test after waiting the specified amount of time


Byebug makes it possible to
  1. 1.
    Step through code one line at a time
  2. 2.
    Pause the driver at some event or specified instruction, to examine the current state.
  3. 3.
    Interact with the state by executing code dynamically at the breakpoint
Byebug Resources:

Running Tests

There is a rake task where you can specify the file containing the driver spec. Drivers themselves are resolved and loaded internally, as they would be in a running system.
  • rake module:test['../aca-device-modules/modules/extron/switcher/dxp_spec.rb']
To simplify the process of running tests, when using the development setup, you can run tests in the browser.
  • Your system is scanned and spec files are listed on the right
  • Selecting a spec will attempt to load the driver file
    • You will see any load errors that occur (such as syntax errors)
    • Discovery information is listed in a table
    • The test is executed in an interactive console, allowing for interactive debugging
    • Click the refresh icon to re-run the test at any point
Last modified 1yr ago