Page 1 of 1

How to check for multiple repo items in parallel

Posted: Thu Jul 13, 2017 6:11 pm
by tvu
Hi everyone,

Is there a way to check the existence of multiple repo items in parallel?

I want to write a script that returns to a default location in a mobile app. I wanted this to be a general purpose script to put in the tear down of each test case. I know I can check for one item and them perform some action. Then repeat this process going through various scenarios with different repo items. But, this adds a lot of wait time.

I was thinking something a long the line of this:

Code: Select all

repoItemThatExists = ReturnTheRepoItemThatExists(repoItem1, repoItem2, repoItem3);

case (repoItemThatExists)
    repoItem1:
        Do something
    repoItem2:
        Do something else
    repoItem3:
        Do magical things
For course, only one of those repo Item would exists at a time.

I want to avoid this:

Code: Select all

if (repoItem1.Exists())
{
    Do something
}

if (repoItem2.Exists())
{
    Do something else
}

if (repoItem3.Exists())
{
    Do magical things
}
If repoItem3 exists, I would have to wait for the search timeouts for repoItem1 and repoItem2 before getting to that point.

Thanks in advance.

Re: How to check for multiple repo items in parallel

Posted: Thu Jul 13, 2017 7:35 pm
by Vega
instead of always checking for all of the repo items of interest, why dont you just make a single function which accepts a repo item as an argument? This way you minimize the wait time by only checking the repo item which is applicable to that scenario. You could reuse this function easily using the code library and there is built in functionality to have it accept repo item adapters / repo item info objects as an argument (see attachment)

Re: How to check for multiple repo items in parallel

Posted: Thu Jul 13, 2017 7:52 pm
by tvu
I am testing an app where I can run into several issues with error pop up appearing, touch operation not having any effect, app is slow to respond, etc...

When this happens, the test case would fail and leave it in an unknown condition. I want to write a script that would check for all these conditions and handle them properly. I am just trying to save on time when serially searching throw a list of conditions,