Setting Up Capture Playback For Automated Testing
I'm trying to integrate cucumber with crank storyboard application for automation testing. For that I'm trying to find ways to click buttons, scroll down & up lists, etc. from a lua script. I found a way of doing this, if I can send gre.press events from lua.
If you have a better way of doing this please let me know.
Have you taken a look at our Capture/Playback functionality?
If you are simply looking for a way to automatically trigger all kinds of input events, it is a really useful tool.
It works by capturing the events triggered in a normal run of your application, and then when you switch it to playback mode it will play the recorded events in sequence.
We use this a lot when it comes to running automated tests/benchmarks.
Capture/Playback is enabled by passing certain command line options to the engine. You can find documentation for the command line options you have to pass in here: (Search for "capture_playback")
The easiest way to try capture/playback for yourself is by setting it up in Storyboard Designer. After opening your application perform these steps:
Step 1: Open Storyboard Simulator Configuration
Step 2: Under Plugin Options, set capture-playback to Capture mode
At the bottom of this menu, you will see that options have been added to the Storyboard Engine Command Line.
These options mean that the next time I execute my application, all of my events will be captured and written to a file called event_capture.txt. These are the same command line options you would pass to the engine if you were performing this directly on your target platform.
Step 3: At this point you can go ahead and Run your application and click around to start capturing those events. Once you're done, you can close your application. In your applications root directory, you will see that the event_capture.txt file has been created.
Step 4: Switch your capture-playback mode to Playback
At this point you can also specify how many times you would like the playback to loop, in the Playback Loops field.
If you would like it to loop indefinitely, set this value to -1. If you would like the playback to terminate the application after the loops have been completed (this is useful if you are capturing performance logs), you can add the quit_playback option.
Step 5: That's it! Run your application and watch as it performs the exact same events that you had performed earlier.
Don't worry, your application isn't haunted. That's just the magic of Capture/Playback!