Wait for queued report to finish running?

3 posts, 1 answers
  1. Scott
    Scott avatar
    68 posts
    Member since:
    Nov 2011

    Posted 08 Mar 2012 Link to this post

    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. Answer
    Cody avatar
    3354 posts

    Posted 08 Mar 2012 Link to this post

    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;
        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.

    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
  3. Scott
    Scott avatar
    68 posts
    Member since:
    Nov 2011

    Posted 10 Mar 2012 Link to this post

    That worked perfectly, thanks!
Back to Top