Testing async loop with Jasmine

334 views
Skip to first unread message

Arya

unread,
Mar 29, 2015, 11:53:39 AM3/29/15
to jasmi...@googlegroups.com

Hi, I am trying to use jasmine to test bunch of http requests that will be executed inside loop. I tried multiple approaches but nothing seems to work.  For example, I tried waitfor and run,  but it executed only once.  Storing response in collection and then execute. This approach does work but I have to wrap everything inside “it”, so I can’t display proper message, so this really useless. Does jasmine support this type of scenario, it yes, how? I couldn't find any example on the net that matches my scenario

var my Requests =function(){

        read a file, which contains urls

         execute async http request inside forEach loop

}

Gregg Van Hove

unread,
Mar 31, 2015, 9:22:54 PM3/31/15
to jasmi...@googlegroups.com
If you have multiple requests, you're either going to need to know how many there are ahead of time in the specs and explicitly wait for each to finish or do wait in a loop to get all of the requests.

-Gregg

--
You received this message because you are subscribed to the Google Groups "Jasmine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jasmine-js+...@googlegroups.com.
To post to this group, send email to jasmi...@googlegroups.com.
Visit this group at http://groups.google.com/group/jasmine-js.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages