Click here to Skip to main content
Click here to Skip to main content

Selenium Testing with FlexPilot

By , 4 Oct 2010
 

I continued my quest for a solution to create automated tests using seleniumRC and C# and this time I took a look at this new project called Flex Pilot.

FlexPilot is a open source testing tool that integrates with selenium,  it has a bootstrapper to make the application testable, it is able to use a selenium IDE recorder, and you can access elements using chain syntax (like accessing with xpath).

Here is what I did to start building tests with flex pilot:

  • Rebuilded flexpilot: source is http://github.com/mde/flex-pilot/archives/master and excecuted build.py this will update FlexPilot.swf and FPBootstrap.swf  located under org/flex_pilot folder (place this file where the app is located)
  • Copied the content from src/org/flex_pilot folder to the flex's app libs folder example C:\source\MyAppInFlex\libs
  • Imported Bootstrap in the flex app
    import org.flex_pilot.FPBootstrap;
  • Set FPBootstrap.flex_pilotLibPath the path on the server where FPBootstrap can find FlexPilot.swf. The Loader fetches FlexPilot.swf via a Loader class.
    FPBootstrap.flex_pilotLibPath = '/flash/org/flex_pilot/FlexPilot.swf';
  • Initialize FPBootstrap this fetch and load FlexPilot.swf, and gives FlexPilot Flash a context to use for testing. This context is usually a reference to app’s Stage.
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:local="*" creationComplete="init() 
    applicationComplete="initFlexPilot()">
    ......
    <mx:Script>
            <![CDATA[
                ...............
                import mx.utils.ObjectUtil;    
                import org.flex_pilot.FPBootstrap;
    
                ...............
                private function initFlexPilot():void
                {
                    FPBootstrap.flex_pilotLibPath = 'FlexPilot.swf';
                    FPBootstrap.init(stage);
                }
    ......
  • Compiled application: mxmlc -source-path=. -source-path+=../libs MyAppInFlex.mxml -o MyAppInFlex.swf
  • If present, remove tags like <noscript> around the flex object in you html.
  • If the configuration is working Firebug will return “function” when calling document.getElementById('MyAppInFlex').fp_click 
  • This is the “hello world” example of a test method on c#
    [TestMethod]
    public void TestMethodFlexPilot()
    {
        selenium.Open("http://localhost/testapp.html");
        selenium.RunScript("document.getElementById('MyAppInFlex').fp_type({name:'usernameTextInput', text:'Flex Pilot'})");
        selenium.RunScript("document.getElementById('MyAppInFlex').fp_click({name:'secureCheckBox'})");
    }

FlexPilot has seleniumRC client drivers available for java, phyton and rubi (no c# client driver available yet)

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

mariangemarcano

Denmark Denmark
No Biography provided

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
GeneralSelenium is not recognizing flexstore application(I am running it in FILE:://.".membernethrarayappa3-May-11 20:41 
Hi,
 
I have installed flexstroe sample application and have followed all
the steps in the https://github.com/mde/flex-pilot/wiki/getting-started.
 

I am using SDK 3.5
Flex pilot 1.0
Selenium 1.0.7.
 

After all the set up i will navigate to the location which contains
flexstore.swf file,right click and open in mozilla .
Open the seleniujm IDE and try to record the interactions but thats
not working for me.(recorder is not recording the interactions on the
application)
 

Given steps are very clear and I see all have there pilot working fine
but its not working for me.
Please help me outFrown | :(
 

Thanks in advance
GeneralRe: Selenium is not recognizing flexstore application(I am running it in FILE:://.".membermariangemarcano4-May-11 18:53 
make sure you get the function message after you do the following:
 
--- If the configuration is working Firebug will return “function” when calling document.getElementById('MyAppInFlex').fp_click
 
if you dont get that, it is likely that something went wrong when executing the steps ..
 
also, you need to make sure you added flexpilot user-extensions.js to Selenium IDE (options window)

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web02 | 2.6.130617.1 | Last Updated 4 Oct 2010
Article Copyright 2010 by mariangemarcano
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid