threading multiple test suites, each suite gets its own thread

239 views
Skip to first unread message

aldentaylor

unread,
Aug 18, 2010, 6:26:06 PM8/18/10
to testng-users
Hi all,

We use testng for integration testing and this is working very well.
We define a suite for each scenario that we want to test which can be
made up of multiple tests. We invoke this process via the Ant testng
task.

What I'm wondering is if there is a way to thread the running of each
suite? That is to say, the suite itself should run in a single thread
with each test running in the specified order, but each suite being
included should run in a separate thread.

So 4 suite.xml files supplied to the <testng> task would run in 4
threads.

We use the reporting capabilities to produce a single report showing
all suites that were run in the test, so we don't want to just invoke
testng once for each suite in the ant <parallel> task.

Is there any way to achieve this?

Cheers,
Alden

Cédric Beust ♔

unread,
Aug 18, 2010, 6:43:57 PM8/18/10
to testng...@googlegroups.com
Hi Alden,

Interestingly, this is the first time that this feature request has come up :-)

It's not possible at the moment, as you probably know, since the parallel configuration can only be specified in <suite> or <test> but not at the "meta suite" level.

I'll look into allowing to specify a "parallelSuites" parameter on the command line or ant which, when passed, will run each suite in its own thread.

--
Cédric




--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to testng...@googlegroups.com.
To unsubscribe from this group, send email to testng-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.




--
Cédric


aldentaylor

unread,
Aug 19, 2010, 4:36:08 PM8/19/10
to testng-users
Thanks Cedric.

Anyway we can get there by extending the org.testng.TestNG class and
defining this as the suiteRunnerClass?

Don't really know the internals of how TestNG is designed, so I'm
asking if this is a viable solution to explore or not.

If not, can we contribute to testNG to add the capability with your
direction?

Many thanks,
Alden
> > testng-users...@googlegroups.com<testng-users%2Bunsu...@googlegroups.com>
> > .

Cédric Beust ♔

unread,
Aug 21, 2010, 11:51:37 PM8/21/10
to testng...@googlegroups.com, alden...@gmail.com
Hi Alden,

I just finished implementing this feature. Download the beta (http://testng.org/beta ) and use "java org.testng.TestNG -suitethreadpoolsize 5" to run your suite in a pool of five threads.

If you're using ant, it's "suitethreadpoolsize".

I only have two tests for this so far so you might find a few bugs, let me know how it works for you.

--
Cédric


To unsubscribe from this group, send email to testng-users...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.




--
Cédric


anil raju

unread,
Aug 22, 2010, 6:11:33 AM8/22/10
to testng...@googlegroups.com, alden...@gmail.com
Hi Cedric,

This is the feature that i have been trying to generate for myself. I was doing this using parallel ant tasks(Had sent a mail yesterday to which you had replied). Guess this will help me a lot... Thanks a ton. Will be testing it tomorrow in office will update you with its success as soon as i'm through with its results.


Thanks & Regards,
Anil Puliyeril



2010/8/22 Cédric Beust ♔ <ced...@beust.com>

anil raju

unread,
Aug 22, 2010, 11:14:03 PM8/22/10
to testng...@googlegroups.com
Hey Cedric,

Does this work only with jdk 1.6?  i tried with jdk 1.5 and got the following exception.

[testng] Exception in thread "main" java.lang.NoClassDefFoundError: java/io/Console
[testng]     at org.testng.TestNG.privateMain(TestNG.java:1083)
[testng]     at org.testng.TestNG.main(TestNG.java:1055)
[testng] The tests failed.

Regards,
Anil Puliyeril

Cédric Beust ♔

unread,
Aug 22, 2010, 11:19:09 PM8/22/10
to testng...@googlegroups.com
Hi Anil,

Unfortunately, yes. It's because I added a dependency on a class in JCommander that I didn't realize was only available in the JDK 1.6. I have a potential solution but for now, please use JDK 1.6.

Sorry for the trouble.

--
Cédric

anil raju

unread,
Aug 23, 2010, 3:39:56 AM8/23/10
to testng...@googlegroups.com
Hey Cedric,

No issues the feature is extremely helpful, will let you know if i face any other issues.


Thanks and Regards,
Anil Puliyeril





2010/8/23 Cédric Beust ♔ <ced...@beust.com>

anil raju

unread,
Aug 24, 2010, 9:57:38 PM8/24/10
to testng...@googlegroups.com
Hey Cedric,

By when is testng 13.2 version scheduled?


Regards,

Anil Puliyeril

aldentaylor

unread,
Aug 31, 2010, 12:26:41 PM8/31/10
to testng-users
Awesome - thanks Cédric.

I'll check it out.

Cheers,
Alden

On Aug 21, 8:51 pm, Cédric Beust ♔ <ced...@beust.com> wrote:
> Hi Alden,
>
> I just finished implementing this feature. Download the beta (http://testng.org/beta) and use "java org.testng.TestNG
> > <testng-users%2Bunsu...@googlegroups.com<testng-users%252Buns...@googlegroups.com>
Reply all
Reply to author
Forward
0 new messages