Running multiple tests in parallel

Best practices, code snippets for common functionality, examples, and guidelines.
atul.thakor
Posts: 4
Joined: Tue Mar 02, 2010 4:06 pm

Running multiple tests in parallel

Post by atul.thakor » Tue Mar 02, 2010 4:27 pm

Hi,

We have created a test on our site using the .net API.

We would like to know if its possible to run multiple tests in parallel, we assume not because of mouse clicks being part of the script as they require the active window to run.

I have tried to use the PerformClick() rather than Click() but found this not to work.

Are there any other options other than running single tests on multiple machines?

Many Thanks

AT

User avatar
Ciege
Ranorex Guru
Posts: 1335
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

Re: Running multiple tests in parallel

Post by Ciege » Tue Mar 02, 2010 5:32 pm

Possible... Sure.
Advisable... Not really.

You run the potential for a lot of things to go wrong unless you do a lot of coding on your side to verify synchronization and GUI availability not to mention the possibility for multiple threads wreaking havoc on each other.

That being said... What is your reason for wanting to run multiple tests in parallel? why not run them in serial? Wrap your different tests in a "master" script that calls each test successively after the previous test has completed. I would also add some cleanup code to verify that your AUT is in a known good state before each next test case is executed and for any possibly cleanup of the previous test case fails for any reason.
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!

Ciege...

atul.thakor
Posts: 4
Joined: Tue Mar 02, 2010 4:06 pm

Re: Running multiple tests in parallel

Post by atul.thakor » Tue Mar 02, 2010 6:17 pm

Purely due to the amount of testing we need to run in limited time. Worst case scenario we can throw hardware at the problem but best case would be to run multiple tests in parallel.

Taking a simple example:
If we wanted to google animal types in google and we wanted to search for:
Cat
Dog
Rabbit
Goat
Sheep

And search for them at the same time in parallel how would we go about accomodating the mouse clicks to ensure that the correct window is clicked for the correct session as I cant find anything in the web respository that could help?

Thanks

User avatar
Ciege
Ranorex Guru
Posts: 1335
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

Re: Running multiple tests in parallel

Post by Ciege » Tue Mar 02, 2010 6:28 pm

If you are really only doing browser testing you can look into using the DOM. With the DOM object of IE you do not (usually) need to do any mouse clicks. Further the browser could even be in a minimized state and testing can continue.

Once you get the DOM object you can set values (like in the Google search box) and fire the click event of the submit button then read the results all without having to move the mouse. Once you understand how to call the DOM events yourself it's actually quite easy. There are limitation though... Some click events trigger other code to happen specifically when the mouse is clicked on that item so you would also need to fire any events that are supposed to occur from a physical click yourself to make sure they happen correctly. Also, any non-DOM windows (like an IE popup window) would need to be handled apart from your DOM code.

But more to the point of your question about making sure a click occurs in the correct window. You can call the window.activate() method from Ranorex to make sure that the specific window you want to work with is active. You can also call the window.minimize() method on the other windows that do not need a click at this time if you want to. Still, with this, you would need to 100% verify in code that two threads are not trying to work on a window at the same time, else you will have a very high chance of failure.
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!

Ciege...

atom
Posts: 357
Joined: Sun Dec 07, 2008 11:14 pm
Location: Dublin, Ireland

Re: Running multiple tests in parallel

Post by atom » Fri Mar 05, 2010 1:09 pm

Hiya,

There is a difference between "running tests in parallel", and "performing operations on many windows" !
GUI Automation can only do one thing at once, in the same way a real user can only click/type into one window at once.

For performing operations in many windows, this is possible by giving Focus to each window in turn, and perform the operation in that window. For running tests in parallel you will need seperate machines to do that.

Cheers

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Running multiple tests in parallel

Post by Support Team » Wed Mar 10, 2010 7:06 pm

As ciege already said, in theory you should be able to automate web pages without mouse or keyboard input just by setting the web element attributes or calling the WebElement.PerformClick method instead of the usual Click method. Similarly you could automate non-web applications just by setting attributes or invoking actions, e.g. use Button.Press instead of Button.Click. That way, you would be able to create tests that won't influence each other and could run in parallel.

However, not all technologies or controls support this functionality (e.g. WinForms and Web apps should usually work), so it depends on the technology and on the (implementation of the) automated controls whether a non-mouse click will work reliably. For example, some controls accept mouse clicks only if the control has the focus.

Regards,
Alex
Ranorex Support Team
.
Image