Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Perl to test Flash?

by sundialsvc4 (Abbot)
on Mar 10, 2011 at 22:09 UTC ( [id://892546]=perlquestion: print w/replies, xml ) Need Help??

sundialsvc4 has asked for the wisdom of the Perl Monks concerning the following question:

I have inherited a legacy application which uses Flash to implement part of its user interface.   I have all of the relevant source code, and control of both the client and the server side.   What I want to do is to build-out a set of validation tests for the thing, i.e. simulating certain user actions and then verifying that the correct response is received.   I humbly request that the Monks may grant me Enlightenment on these fell matters, and Guidance that may lead me through these dark woods.

Replies are listed 'Best First'.
Re: Perl to test Flash?
by Corion (Patriarch) on Mar 10, 2011 at 22:23 UTC

    The easy part is to automate the server side. Just get the Mozilla Live HTTP Headers plugin and track what requests the Flash app makes to the server, and (parametrize and) replay them against your server to make sure that the "usual" transactions work and return the expected results.

    The hard part will be to automate the Flash application. I'm not aware of a convenient way to extract user interface elements like clickable areas from Flash, so I'd load the application into a browser and then send mouse clicks to it, for example via Win32::GUITest or maybe via WWW::Mechanize::Firefox (but I've never done that, and I'm the author of the module) to automate the application and capture the resulting HTTP requests.

    Testing the application itself is much harder, as you need to verify that what displays on the screen remains the same. adamk has written Imager::Search, and there are other Screenshot modules that you can use to compare what the Flash application displays to what you expect. If all else fails, set up the Flash app in a VNC server and then capture the VNC client screen to get an image of what happens even without a (real) display connected. But this part of the automation is highly fragile as even the change of the background colour will mean you have to reacquire the complete test data and confirm the whole test suite manually.

      Excellent thoughts, thank you.

      To clarify ... since I “own” both sides of this application (and can, if need be, add instrumentation or even test-jigs to “the back side”), and since the app is thought to be “working now,” my primary purpose in this case is somewhat specialized.   I want to establish how the app is supposed to be “working” now, so as to be able to automatically detect when it isn’t working any more, i.e. as the unintentional result of a recent change that introduced a bug.   In other words, regression testing.   So I will be mainly looking for differences from a known set of outputs given a known set of simulated-user inputs.   I want to be able to accomplish this automagically and at high speed.   Any report of discrepancies can trigger (manual, human) investigation, which will not need to involve automated assistance.

Re: Perl to test Flash?
by siraj (Sexton) on Mar 11, 2011 at 05:43 UTC
    Check if Selenium can help you..
    Selenium IDE is a Firefox add-on that records clicks, typing, and other actions to make a test, which you can play back in the browser.
    http://seleniumhq.org/

    Regards,
    Siraj

      /me nods...

      Thank you for your excellent suggestion.   Naturally, I desire to drive this (at least on the outermost level) strictly from a shell command, and to minimize isolate the influences of “browser versions.”   Yet I understand, of course, that this is not 100% achievable.

      I fully realize that this kind of testing-scenario is greatly complicated by the fact that Flash is client-side software, with several different not-quite compatible versions of the client-side engine.   (Meh... the preceding sentence is called, “tact” “diplomacy.”)   Not to mention the fact that browsers are “client-side software” too, as are the client-side operating systems.   I know that I’m going to make compromises, so to speak.   “To test this experiment, I must be partly inside the experiment.”   I desire for these compromises to be the best and most well-considered set of compromises ... which is why I am humbly petitioning here.

      It is important to emphasize that my scenario is regression testing.   The Flash code works, and it is not my immediate objective to verify that it does so.   Rather, I seek to automate tests which will detect if it ever ceases to do so.   I want to barrage it with tests, each of which has known expected outcomes.   If the system falls out of compliance, I want to know.

Re: Perl to test Flash?
by zentara (Archbishop) on Mar 11, 2011 at 15:38 UTC
    You might want to use Gtk2::WebKit ..... see Perl Web Browser using Gtk2 and WebKit for simple code It displays flash just as a browser would. It's onl;y hitch right now, is that if you are on a 64bit computer, you need the 32-bit emulation libaries, because the current Flash plugin is only 32 bit.( last time I checked, although there is a beta 64 bit)

    I'm not really a human, but I play one on earth.
    Old Perl Programmer Haiku ................... flash japh
Re: Perl to test Flash?
by mamboking (Monk) on Mar 11, 2011 at 20:13 UTC
    Check out AMF::Perl. AMF is Active Message Format. It's a binary format that Adobe uses when serializing objects. If your application is using something like BlazeDS to interact with the server then you can use AMF::Perl to generate the messages programmaticaly.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://892546]
Approved by GrandFather
Front-paged by chrestomanci
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2024-04-20 04:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found