Testing multi thread application

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Testing multi thread application

Yogesh Sharma
Team,

I have set of Classes which implements Runnable
how do I write test cases to test this multi threaded code?  How do I make test case to wait for all child thread to  be completed before assert  (then) is called.

Waiting to read you back...

--
You received this message because you are subscribed to the Google Groups "Spock Framework - User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/spockframework.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Testing multi thread application

Marcin Zajączkowski
On 2016-12-18 14:17, Yogesh Sharma wrote:
> Team,
>
> I have set of Classes which implements Runnable
> how do I write test cases to test this multi threaded code?  How do I make
> test case to wait for all child thread to  be completed before assert
>  (then) is called.

PollingConditions could be useful here:
http://spockframework.org/spock/javadoc/1.1-rc-3/spock/util/concurrent/PollingConditions.html

Marcin

--
You received this message because you are subscribed to the Google Groups "Spock Framework - User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/spockframework.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Testing multi thread application

Yogesh Sharma

Thanks Marcin 

is this using thread sleep or wait internally, any more example on usage..


~ Regards
Yogesh

On Tuesday, December 20, 2016 at 3:24:48 AM UTC+5:30, Marcin Zajączkowski wrote:
On 2016-12-18 14:17, Yogesh Sharma wrote:
> Team,
>
> I have set of Classes which implements Runnable
> how do I write test cases to test this multi threaded code?  How do I make
> test case to wait for all child thread to  be completed before assert
>  (then) is called.

PollingConditions could be useful here:
<a href="http://spockframework.org/spock/javadoc/1.1-rc-3/spock/util/concurrent/PollingConditions.html" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fspockframework.org%2Fspock%2Fjavadoc%2F1.1-rc-3%2Fspock%2Futil%2Fconcurrent%2FPollingConditions.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHhTVqQBrE9JKtSXqUIUhLaTidbuw&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fspockframework.org%2Fspock%2Fjavadoc%2F1.1-rc-3%2Fspock%2Futil%2Fconcurrent%2FPollingConditions.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHhTVqQBrE9JKtSXqUIUhLaTidbuw&#39;;return true;">http://spockframework.org/spock/javadoc/1.1-rc-3/spock/util/concurrent/PollingConditions.html

Marcin

--
You received this message because you are subscribed to the Google Groups "Spock Framework - User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/spockframework.
For more options, visit https://groups.google.com/d/optout.