Question about threadPoolSize, timeOut and invocationTimeOut

976 views
Skip to first unread message

kranjcec

unread,
Feb 2, 2012, 9:54:04 AM2/2/12
to testng-users
Hi everyone!

I'm trying to use TestNG for stress testing with timeOut and
invocationTimeOut on those tests. Problem is that timeOut and
invocationTimeOut are ignored when using threadPoolSize. This is
simple tests that I think should fail but TestNG mark all of them with
PASSED.

Tests:
public class TestNgTest {

@Test( invocationTimeOut = 10, invocationCount = 10, threadPoolSize
= 5 )
public void test1ShouldFail() throws InterruptedException {
Thread.sleep( 2000 );
}

@Test( timeOut = 10, invocationTimeOut = 100, invocationCount = 10,
threadPoolSize = 5 )
public void test2ShouldFail() throws InterruptedException {
Thread.sleep( 2000 );
}

@Test( invocationTimeOut = 500, invocationCount = 10,
threadPoolSize = 2 )
public void test3ShouldFail() throws InterruptedException {
Thread.sleep( 2000 );
}

}

Output:
[TestRunner] Starting executor timeOut:0ms workers:10 threadPoolSize:5
[TestRunner] Starting executor timeOut:10ms workers:10 threadPoolSize:
5
[TestRunner] Starting executor timeOut:0ms workers:10 threadPoolSize:2
...
===============================================
Default test
Tests run: 30, Failures: 0, Skips: 0
===============================================

How to set timeOut and invocationTimeOut when using threadPoolSize
(for stress testing)?

Thanks,
Denis

Cédric Beust ♔

unread,
Feb 2, 2012, 2:09:00 PM2/2/12
to testng...@googlegroups.com
Hi Denis,

Two things:
  1. You should use timeOut, not invocationTimeOut (check out the javadoc for the difference).
  2. On top of this, there was a bug in TestNG in the way the time outs were handled, which I just fixed.
Please try again on the beta and report back: http://testng.org/beta

Thanks!

-- 
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.


kranjcec

unread,
Feb 3, 2012, 8:11:24 AM2/3/12
to testng...@googlegroups.com
Hi Cédric,

1)
I did checked javadoc for timeOut and invocationTimeOut and, as I understand, timeOut is maximum number of milliseconds for each invocation of test and invocationTimeOut is maximum number of milliseconds for all invocations together - I would like to use both timeouts in my tests. Is that possible?

2)
I tried with testng-6.4beta and behavior is same, all tests are PASSED:
[TestRunner] Starting executor timeOut:0ms workers:10 threadPoolSize:5
[TestRunner] Starting executor timeOut:10ms workers:10 threadPoolSize:5
[TestRunner] Starting executor timeOut:0ms workers:10 threadPoolSize:2
...
===============================================
    Default test
    Tests run: 30, Failures: 0, Skips: 0
===============================================


Thanks,
Denis

Cédric Beust ♔

unread,
Feb 3, 2012, 1:12:19 PM2/3/12
to testng...@googlegroups.com
Are you sure you are using the beta? The best way is to use ant or even the command line.

-- 
Cédric




Thanks,
Denis

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/testng-users/-/sdbBGVyxPpoJ.

kranjcec

unread,
Feb 7, 2012, 7:14:28 AM2/7/12
to testng-users
I downloaded it again, and in testng-6.4beta.jar in MANIFEST.MF is:
Implementation-Version: 6.4beta-201202021107

All tests are still passing OK.


Is it possible to use both timeouts for stress testing?

Thanks,
Denis

On Feb 3, 7:12 pm, Cédric Beust ♔ <ced...@beust.com> wrote:
> Are you sure you are using the beta? The best way is to use ant or even the
> command line.
>
> --
> Cédric
...

kranjcec

unread,
Feb 14, 2012, 8:39:22 AM2/14/12
to testng...@googlegroups.com
Hi everyone,

I tried also with testng from git repo and still got same results - all tests have passed:
[TestRunner] Starting executor timeOut:0ms workers:10 threadPoolSize:5
[TestRunner] Starting executor timeOut:10ms workers:10 threadPoolSize:5
[TestRunner] Starting executor timeOut:0ms workers:10 threadPoolSize:2
...
===============================================
    Default test
    Tests run: 30, Failures: 0, Skips: 0
===============================================

1. Am I doing something wrong or this is problem with TestNG?

2. Is it possible to use timeOut and invocationTimeOut with threadPoolSize?

Thanks,
Denis
Reply all
Reply to author
Forward
0 new messages