[Webtest] Multi-Threading in WebTest

Marc Guillemot Marc Guillemot <mguillemot@yahoo.fr>
Tue, 08 Jul 2008 11:31:26 +0200

Hi William,

Soula, William wrote:
> I have been playing around with webtest and multi-threading to try and
> get my tests to run in less time than they currently are.  My first
> attempt was just to try and multi-thread one test.  This is not possible
> unless you break the test up into smaller test files? (I tried having
> several webtest nodes in the project file and got errors)  Ok, fine
> that's cool I can deal with that, then I ran into the problem of
> multi-threading doesn't work on a dataDriven step using excel?  Now its
> getting less useful.  So now I'm thinkin that I can put the first test
> in the allTests.xml file and then link the tests together to get some
> tests seqential and allow others to multi-thread.  But now I have the
> problem that all webtest nodes go into a giant queue and the threads
> just grab off of that?  Getting more and more disappointed, maybe I can
> fix this problem by starting with one thread and then moving to several
> threads later in the test.  Nope?
> So in summary my questions are:
> Can you multi-thread within a test? (<parallel> for example?)

you can use <parallel> as it is an Ant task, but this will surely cause
Besides the technical aspect, can you describe a use case where it makes
sense? A user that logs in normally and then becomes thousand hands and
eyes to surf to multiple pages simultaneously? ;-)

> Does multi-threading work on a dataDriven step using excel?

yes, as long as your dataDriven contains a <webtest>

> Is there any way to define the order tests are run? (for example, have
> tests a, b, c run concurrently to x, y, z; and when test a finishes test
> b is run etc?)

not currently

> Is there a way to increase/decrease the thread count during the test?
> (for the above example, after c runs open up the thread count to 30 to
> allow multiple tests to run after c?)

not currently

> Have I possibly missed something and all this is in there or this is not
> the appropriate way to test with webtest?

Sorry, I don't understand the question.

Just a reminder, I've had the idea of this simple parallel execution
when I had to cope with test servers that were terribly slow by a
client. I've made the current implementation in my free time and haven't
really used it by myself (I don't work for this client anymore). Many
improvements can still be done, for instance to handle dependencies, and
it would be a pleasure for me to work on it if you want to hire me for
instance but in the mean time, I prefer to use my free time to work on
other aspects of WebTest.

Blog: http://mguillem.wordpress.com