Validator: Testing using Storyboard IO Events with Data

The release of Storyboard 8.0 marks the first release of Validator. While creating Tests, users are able to inject a Storyboard IO event as a Test Action in a Test Sequence. Current support does not permit for SBIO events with data as a Test Action. If your application requires the use of SBIO events with data to advance a test, here are 2 alternative methods for getting around this. 

Option #1: Utilizing Event Playback

Capture/Playback is a Storyboard tool that allows for recording and replaying of events. Historically it was recommended for automated testing of the UI before Validator was introduced. Event files generated from the Capture/Playback plugin have the ability to record specified incoming SBIO events and their data. Here is an example of setting up an event capture to listen for 2 SBIO events, UpdateOutsideTemp and OutsideWeather:

The output from an event capture is an XML file with time stamps of incoming events and data values. This event file can then be imported as an "Event Playback" Test Action in a Test Sequence.

To gather the pass/fail references for these events, you can either manually inject them with a "Capture Data" Test Point, or run the test and in the results tab, right click on "Missing Reference":

Note: If you use the Capture/Playback plugin, make sure you disable it before launching a Validator test. These plugins will conflict and your test will either not run or be overwritten.

 

Option #2: Using a script callback to send events with data

Lua and JavaScript have the ability to send SBIO events with data to the application with gre.send_event_data and sb.sendEvent . With these functions you can set up a script to mimic a real SBIO event with the expected data.

First step is to set up a Callback Event at the Application level. For example, "TestUpdateOutsideTemp". Then in Lua or Javascript, write a function to send "UpdateOutsideTemp" with a temperature value, let's say it's 35 degrees. This test temperature value can either be hard-coded or grabbed from another source.

function testOutsideTempEvent (mapargs)
local name = "UpdateOutsideTemp"
local format = "2u1 outsideTemp"
local data = { outsideTemp = 35 }
local channel = "thermostat"

gre.send_event_data(name,format,data,channel)
end

Now in Validator you can send the event "TestUpdateOutsideTemp" as a Test Action, and set the Test Point to Capture Data for 35 degrees.



Responding to Storyboard IO events with data is a planned feature for the future of Validator but right now these are some simple solutions to move your tests along easily. 

0

Comments

3 comments
  • Thanks Sarah this is super useful

    0
  • Hello Sarah, 

    when I choose the second option, is there a way how to send an event with parameters?
    How it should be called from the Validator test action?

    Thank you.

    Regards, 
    Petr Hanel

    0
  • Hello Petr,

    .As today, Validator Test Action only supports named events. So, it is not possible to send arguments from there.
    .Validator Send Events section does allow you however to create an event playback action.
    .If you need to use for events with a data payload the event playback action is the one you want to use as described on the post

    Br
    -Max

    0

Please sign in to leave a comment.

Didn't find what you were looking for?

New post