This is a migrated thread and some comments may be shown as answers.

Wait for queued report to finish running?

2 Answers 76 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Scott
Top achievements
Rank 2
Scott asked on 08 Mar 2012, 08:24 PM
We have reports that we run, and they are put into a queue. In the list of running reports, they can have a status of "Waiting in Queue", "Running Report", "Ready", "Error", etc...

I am wanting to setup a test step that will continue refreshing the queue list web page, count the number of "Waiting in Queue", or "Running Report" and only continue with running additional reports if the count is less than 10.

Does this make sense? And how would I accomplish such a thing in Test Studio?

Thanks in advance!

2 Answers, 1 is accepted

Sort by
0
Accepted
Cody
Telerik team
answered on 08 Mar 2012, 11:41 PM
Hello Scott,

In a coded step you can get a count of all "Waiting in Queue", "Running Report", etc. text elements and stay in a loop while that total count is over your limit (e.g. 10).

Here's a quick code sample demonstrating this:

ReadOnlyCollection<Element> list1;
ReadOnlyCollection<Element> list2;
do
{
    System.Threading.Thread.Sleep(1000);
      ActiveBrowser.Refresh();
    list1 = ActiveBrowser.Find.AllByContent("Waiting in Queue");
    list2 = ActiveBrowser.Find.AllByContent("Running Report");
} while (list1.Count + list2.Count > 10);

You can use our code converter if you need the VB equivalent. The only other thing I personally would add to it is a timeout catch so that it doesn't get caught in an infinite loop if the somehow something serious goes wrong and the status is never changing.

Greetings,
Cody
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Scott
Top achievements
Rank 2
answered on 10 Mar 2012, 03:05 PM
That worked perfectly, thanks!
Tags
General Discussions
Asked by
Scott
Top achievements
Rank 2
Answers by
Cody
Telerik team
Scott
Top achievements
Rank 2
Share this question
or