damu11782 / rest-assured

Automatically exported from code.google.com/p/rest-assured
0 stars 0 forks source link

Support baseURL/port setting for parallel testing #379

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Set RestAssured.baseURL and RestAssured.port in a @BeforeClass
2. Have multiple tests using different baseURLs/ports but without specifying on 
each rest-assured invocation
3. Running tests in sequence work as expected
4. Running tests in parallel fail as baseURLs and ports are statics

So, the issue here is that as baseURLs and port are statics, running tests in 
parallel mix them up.
This is how things should work.

But, what would you propose in order to be able to run tests in parallel 
without specifying baseURL & port on each rest-assured invocation ?

I see nasty ThreadLocals ... but maybe you could suggest something else I 
haven't tought about.

Loving rest-assured BTW :)

Original issue reported on code.google.com by eskato...@gmail.com on 15 Dec 2014 at 9:43

GoogleCodeExporter commented 9 years ago
REST Assured has not been designed for parallel testing unfortunately. The best 
way to make it work in parallel would be to make  everything immutable. And the 
API's have been designed to allow this (since is why the configuration can be a 
bit quirky for example). But under the covers REST Assured mutates state 
internally which is a big problem for parallel tests. Perhaps I should have 
written it in Clojure instead of Groovy :)

Original comment by johan.ha...@gmail.com on 30 Dec 2014 at 9:07

GoogleCodeExporter commented 9 years ago
Thanks for the feedback Johan!
That's unfortunate but looks like we'll have to live with it.
Cheers

Original comment by eskato...@gmail.com on 8 Jan 2015 at 7:47