New feature: @Test(sequential = true)

53 views
Skip to first unread message

Cédric Beust ♔

unread,
Aug 14, 2006, 4:12:19 PM8/14/06
to testng...@googlegroups.com
I just implemented the feature we discussed:

@Test(sequential = true)

or

/**
 * @testng.test sequential = "true"
 */

Documentation:

  /**
   * If set to true, all the methods on this test class are guaranteed to run
   * sequentially, even if the tests are currently being run with parallel="true".
   *
   * This attribute can only be used at the class level and it will be ignored
   * if used at the method level.
   */

Please download TestNG 5.1 beta to try it and let me know how it works for you!

--
Cédric

Feuer, Adam

unread,
Aug 14, 2006, 5:27:24 PM8/14/06
to testng...@googlegroups.com
Cedric,

Wow! Thank you! We will get this and test it! I'll let you know how it goes!

-adam

--
Adam Feuer
afe...@amazon.com 206-266-4726
Amazon.com Enterprise Commerce Services

> -----Original Message-----
> From: testng...@googlegroups.com
> [mailto:testng...@googlegroups.com] On Behalf Of Cédric Beust ?
> Sent: Monday, August 14, 2006 1:12 PM
> To: testng...@googlegroups.com
> Subject: [testng-users] New feature: @Test(sequential = true)
>
> I just implemented the feature we discussed:
>
> @Test(sequential = true)
>
> or
>
> /**
> * @testng.test sequential = "true"
> */
>
> Documentation:
>
> /**
> * If set to true, all the methods on this test class are
> guaranteed to run
> * sequentially, even if the tests are currently being run
> with parallel="true".
> *
> * This attribute can only be used at the class level and
> it will be ignored
> * if used at the method level.
> */
>
> Please download TestNG 5.1 beta

> <http://testng.org/testng-5.1beta.zip> to try it and let me

> know how it works for you!
>
> --

> Cdric
>
> >
>
>

BK Lau

unread,
Aug 15, 2006, 11:13:12 AM8/15/06
to testng...@googlegroups.com
Cederic:

When I have "junit=true" set in my testng.xml, this new feature wouln't have any impact or apply at all right since at suite level parallel="false"..right?.

Thanks,

-BK-
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=40224&messageID=80093#80093

Cédric Beust ♔

unread,
Aug 15, 2006, 11:33:30 AM8/15/06
to testng...@googlegroups.com
Correct.  The JUnit mode doesn't use any of the multithread setting.

--
Cedric

Feuer, Adam

unread,
Aug 15, 2006, 8:01:56 PM8/15/06
to testng...@googlegroups.com, cbe...@google.com
Cedric,

We tried it out- it works as we want it to. We are converting all our tests over to it now, and will report back on the results. Thank you very very much! :-) This helps us a lot- by ensuring consistent test results without brittle "depends-on" ordering annotations.

By the way, regarding the annotation "sequential"... or "atomic"... another name Chris Ahlering, one of our developers suggested was "serial". He thought this implied that you could not set the order, but that it would be non-overlapping.

cheers

Cédric Beust ♔

unread,
Aug 16, 2006, 2:58:17 AM8/16/06
to Feuer, Adam, testng...@googlegroups.com
On 8/15/06, Feuer, Adam <afe...@amazon.com> wrote:
Cedric,

We tried it out- it works as we want it to. We are converting all our tests over to it now, and will report back on the results. Thank you very very much! :-) This helps us a lot- by ensuring consistent test results without brittle "depends-on" ordering annotations.

Great!

FYI, I'm aware of a slight limitation of the current implementation:  all the sequential methods are put in the same thread, which might be a problem if you start having a lot of them.  Let me know if/when you end up hitting that wall and I'll improve the way these threads are handled (I have a few ideas on how to do that).

--
Cédric

Feuer, Adam

unread,
Aug 16, 2006, 1:22:49 PM8/16/06
to Cédric Beust ♔, testng...@googlegroups.com, Ahlering, Chris
Cédric Beust wrote:

> FYI, I'm aware of a slight limitation of the current
> implementation: all the sequential methods are put in the
> same thread, which might be a problem if you start having a
> lot of them.

Cédric,

When you say that "all the sequential methods are put in the same thread", do you mean that all the methods from one test class go into one thread, and that all the methods from another test class go into another thread, and so on? Or do you mean that all the sequential methods for all the test classes go into one thread?

If it's the latter, it defeats the parallelization- all our test classes (~300 of them) will use the sequential tag, and we would like to run them in parallel!

Cédric Beust ♔

unread,
Aug 16, 2006, 5:38:03 PM8/16/06
to Feuer, Adam, testng...@googlegroups.com, Ahlering, Chris
On 8/16/06, Feuer, Adam <afe...@amazon.com> wrote:

Cédric,

When you say that "all the sequential methods are put in the same thread", do you mean that all the methods from one test class go into one thread, and that all the methods from another test class go into another thread, and so on? Or do you mean that all the sequential methods for all the test classes go into one thread?

If it's the latter, it defeats the parallelization- all our test classes (~300 of them) will use the sequential tag, and we would like to run them in parallel!

The latter.

But fear not, I realized it would be a problem for you, so I fixed it.

If you download 5.1 from the Web site (which I just re-uploaded), you will get the fixed version.

Note that the threads used to run your sequential classes are picked from the common pool, so you might have to increase its size (some of the workers will take longer before being returned to the pool since they now run entire classes).

I'm very curious to see if with all these changes, you will still find the parallel mode that useful.  Based on what you said, you are running in parallel but with quite a few tests running sequentially, so I wonder if it's not going to be a wash in the end...

If possible, I would love to get a few figures from you (# of tests, changing the # of threads, how it impacts the running time, etc...).

Please post your results!

--
Cédric

Feuer, Adam

unread,
Aug 16, 2006, 6:12:53 PM8/16/06
to Cédric Beust ♔, testng...@googlegroups.com, Ahlering, Chris
Cédric,

We will try it and post the results. Thank you!

cheers
adam

--
Adam Feuer
afe...@amazon.com
Amazon.com Enterprise Commerce Services

Reply all
Reply to author
Forward
0 new messages