Wednesday

Automated UI Tester / Genie



  • Automated UI Tester for Adobe® Action Script® is code named as Genie.

Automated UI Tester is a Flash/Flex automation tool that can record user actions on a SWF file and play them back with high fidelity. With other automation tools, automating Flash applications requires instrumenting them to run inside a wrapper application; but with Genie, it just requires a configuration file and Flash Player. So with Genie, users can automate their production builds easily. Genie currently works on Windows and on Mac OS X.

What you need to setup Genie:

1) Eclipse
2) Genie binary
3) Flash Debug version for IE
4) Any flash application

**Genie does not require instrumentation of you flex app for getting access to flex components unlike most tools. 


Limitations: Only works for Action Script 3 based flex applications.
 
Installation:
Genie setup can be done in 5 minutes flat once the per-requisites are installed.
 
You will need the following prerequisites.
1. Eclipse 
2. Adobe Flash Debugger 

For installation, copy the Genie-binary.zip file from http://sourceforge.net/adobe/genie/wiki/Home/ and follow the steps in Userguide.
Adobe has setup a Genie discussion forum as well, which can be accessed from http://sourceforge.net/adobe/genie/discussion/general/
 
Important:
Once Genie is setup, you will see the below icon on every flash application. If you see the arrow sign in green, then Genie and Eclipse are setup correctly, you can simply click on that green arrow to start recording. On stopping the recording, Genie popups a dialog box which has the java code, which you can copy and use.

 


    



import com.adobe.genie.executor.Genie;
import com.adobe.genie.executor.LogConfig;
import com.adobe.genie.executor.components.GenieButton;
import com.adobe.genie.executor.components.GenieTextInput;
import com.adobe.genie.genieCom.SWFApp;

EXAMPLE:

public class GenieAPIExample {

    //Main method
    public static void main(String[] args) {
        //Instantiate LogConfig class.
        LogConfig l = new LogConfig();
        //Set log folder
        l.setLogFolder("C\\GenieLogs\\");
        //Create a Genie class object.
        Genie g = null;
        try{
      
            Genie.EXIT_ON_FAILURE = true;
            //Initialize Genie class.
            g = Genie.init(l);
          
            //connect to app
            SWFApp app1=g.connectToApp("test");

//Get an object from app and enter text into it         
  GenieDisplayObject host = new GenieDisplayObject("FP^TextInputSkin:::SE^RichEditableText:::CH^TextLine::PX^1::PTR^0::IX^0::ITR^0", app1);
            System.out.println(host.isVisible());
            //host.click();
            new UIKeyBoard().typeText("192.168.1.2");

//Clicking on images in the application

new UIImage().clickImage("F:\\test\\Genie-binary\\Genie\\images\\registerbutton.png", 10);
          
        }catch(Exception e)
        {
            System.out.println(e.getMessage());
        }
        finally
        {
            //Invoke stop() method to perform clean up steps.
            // If stop() does not run then socket connections do not close and JVM does not exit.
            g.stop();
        }

    }
}


Saturday

Send mail to outlook even when the smtp server/port is blocked

This is probably the simplest thing that an automation engineer can do:



Automate using vb-script sending an email to outlook:
The best way would be to create a CDO.message object like this :

Set MyEmail=CreateObject("CDO.Message")

MyEmail.Subject="Subject"
MyEmail.From="name@domain.com"
MyEmail.To="a@a.com"
MyEmail.TextBody="Testing one two three."

MyEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing")=2

'SMTP Server
MyEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver")="smtp.server.com"

'SMTP Port
MyEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport")=25 

MyEmail.Configuration.Fields.Update
MyEmail.Send

set MyEmail=nothing
 
But if you have restrictions in your org do this:

Function FnSendMail(intVal)
                Set MyApp = CreateObject("Outlook.Application")
                Set MyItem = MyApp.CreateItem(0)
                With MyItem
                          .To = "aditya.kalra@xyz.com;more@xyz.com"
                          .Subject = "Alert - Automated Email"
                          .ReadReceiptRequested = False
                          .HTMLBody = "
Automated Report

Alert: You have received this:  "&intVal&"%
"
                        End With
                MyItem.Send

End Function