Cogitek RIATest 3 Documentation Copyright © Cogitek Inc.

Automating a Flex application that is accessible behind an HTML login page

Since RIATest is a Flex-only automation solution it is not capable of directly automating HTML pages. If your Flex application is accessible behind an HTML login page then you will need somehow to tell RIATest to perform operations that are necessary to log the user in before your Flex application is loaded in the browser and can be directly automated by RIATest.

The typical way to organize applications which have separate HTML login pages is as follows:

  1. Have a login page at http://myserver.mydomain.com/myapp/index.html. This login page contains an HTML form with username and password fields and a "Login" button.
  2. When the login form is submitted it sends username and password credentials to a server-side login script, let us assume the server-side script is located at http://myserver.mydomain.com/myapp/dologin.php
  3. The login script verifies the username and password and if they are valid performs an HTTP redirect to another page which contains your actual Flex application, e.g.: http://myserver.mydomain.com/myapp/flexapp.html

Since RIATest is not capable of submitting the login form on a pure HTML page you need to bypass this login page but still ensure that the necessary server-side login operations are performed so that your Flex application will operate normally. This can usually be achieved by skipping the login page and loading your server-side login script URL directly in the browser.

Assuming that your login form uses "username" and "password" fields to pass credentials to login script you should be able to initiate the login by directly opening the following URL in your browser: http://myserver.mydomain.com/myapp/dologin.php?username=myname&password=mypass (substitute myname and mypass by valid credentials). Opening this URL in your browser will send login credentials to your server side script, which after performing the validation will redirect to your Flex application which will then be loaded in the browser.

After the application is loaded in the browser, the Agent will initialize and connect to RIATest. Once the Agent is connected to RIATest you will be able to automate your Flex application normally. (Please initially try to open this URL manually in your browser to ensure it works as expected - logs you in and opens your Flex application. If it worked then you can make RIATest do the same automatically.)

To utilize this technique you need to

  1. Firstly embed RIATest Agent in your application by statically compiling with the Agent and Flex automation libraries.
  2. Then create a RIATest project and select "In browser, standalone application" application loading type in project options.
  3. In the Application URL enter http://myserver.mydomain.com/myapp/dologin.php?username=myname&password=mypass that you tested above manually to ensure it initiates correct login sequence.

You are now to ready to have RIATest automatically open the browser, initiate login script, wait for your Flex application to load and start automating it.

If your application login scheme is not working exactly as above, your developers should be able to implement a special login server-side script that will perform login operations and redirect tothe main Flex application as described in the above scheme. You can then use this special server-side script just for test automation purposes.


Found a typo? Have a suggestion? Please submit your request here.