Page 1 of 1

Testing Flash without Repository - help please

Posted: Tue Feb 02, 2010 4:02 pm
by marcm
Hi,

I am a tester, so please go easy on my coding ability....
I am also new to Ranorex and to testing Flash

We have a need to test a Flash app and in order to integrate Ranorex into our test framework I need to be able to test Flash without a repository using C#.

Basically I need an example that shows me how to click "Button1" on the Flex Example Page without using the repository - a bit like the calculator example.

I have got this far, and am now stuck...
System.Diagnostics.Process.Start("firefox.exe", "http://www.ranorex.com/web-testing-exam ... ample.html");

Mouse.DefaultMoveTime = 300;
Keyboard.DefaultKeyPressTime = 100;
Delay.SpeedFactor = 1.0;
Delay.Milliseconds(2000, false);
I am not sure how to "get a handle" on the Flash app, is it a Form or a FlexObject, a Dom object.

I would appreciate the missing lines of code - if somebody could just show me how to click a button on the Flash app, I will be able to carry on.

Thanks for reading and your help

Re: Testing Flash without Repository - help please

Posted: Tue Feb 02, 2010 4:33 pm
by Support Team
Hi,

Please consider reading our tutorial:

http://www.ranorex.com/Documentation/Ra ... torial.pdf

To your flash questions:
You can use the repository in C#, because the repository only consists of generated code. Just include the generated code file (you can use the Spy to generate the code) in you project file.

If you do not want to use the repository, just use the spy to find the path to your flexobject.
In our example, the path to the flexobject looks like this:
"/dom[@pageurl=...]/body/flexobject[@id='FlexExample']"
FlexObject flex = "/dom[@pageurl='http://www.ranorex.com/web-testing-exam ... ample.html']/body/flexobject[@id='FlexExample']";

// you can either supply a path
var testButton = flex.FindSingle<Button>("button[@id='button1']");
// or for id's you can use the simpler syntax:
var testButton = flex.FindChild<Button>("button1");
testButton.Click();
So in the first step, we grab the flexobject from the web page.
In the second step, we look for the button in the flex object.
You could do it all in one step, of course, but the paths will a bit hard to manage if you have a long script.
(Thats what the repository is for :D )

Regards,
Michael
Ranorex Team

Re: Testing Flash without Repository - help please

Posted: Tue Feb 02, 2010 4:45 pm
by marcm
Thak you for your prompt response.

About the repository I agree that the repositoties are a good idea. The test automation framework that we use handles object recognition strings in a totaly different way. It would be a real pain to incorporate the repository files into our test harness.