Timeout settings in testng.xml

2,351 views
Skip to first unread message

Ryan Morgan

unread,
Sep 9, 2008, 12:37:18 PM9/9/08
to testng-users

I've run into an issue where the time-out setting within the
testng.xml file is getting ignored. Browsing this forum shows a
similar issue was brought up last year. (See thread: time-out
attribute in testng.xml file is not working)

To summarize my issue:

Setting the timeout value for a test via an annotation, e.g.
@Test(timeOut=1000) seems to work just fine. However, setting it in
testng.xml does not:

<test name="MyTest" time-out="1000">
...

Looking at the source code for TestNGContentHanlder, it seems that
time-out is completely ignored for <test> containers.

Am I just doing something wrong, or is this a real issue?

-Ryan

Cédric Beust ♔

unread,
Sep 9, 2008, 1:33:20 PM9/9/08
to testng...@googlegroups.com
Hi Ryan,

This is a bug and I just fixed it, please try:

http://testng.org/testng-5.8.1beta-jdk15.jar

and let me know if this works for you.

--
Cédric

Ryan Morgan

unread,
Sep 9, 2008, 1:54:08 PM9/9/08
to testng-users

Thank you for the quick response. I'm still having issues though.
I'm fairly new to TestNG, so it could be user error. Here's the
source and XML that demonstrates the issue:

<test name="TimeoutTest" time-out="1000">
<classes>
<class name="simple.SimpleTest">
<methods>
<include name="timeoutTest"/>
</methods>
</class>
</classes>
</test>

@Test
public void timeoutTest() throws Exception {
System.out.println("Timeout test");
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
System.out.println("Interrupted!");
}
}

When I use @Test(timeOut=1000) everything works as expected.

-Ryan


On Sep 9, 10:33 am, Cédric Beust ♔ <cbe...@google.com> wrote:
> Hi Ryan,
>
> This is a bug and I just fixed it, please try:
>
> http://testng.org/testng-5.8.1beta-jdk15.jar
>
> and let me know if this works for you.
>
> --
> ***Cédric
> *

Cédric Beust ♔

unread,
Sep 9, 2008, 1:55:51 PM9/9/08
to testng...@googlegroups.com
This is exactly the test that I used (I also tested with putting the time-out in <suite>).  Can you double check?  This test should fail, what are you seeing?

-- 
Cédric

Cédric Beust ♔

unread,
Sep 9, 2008, 2:01:39 PM9/9/08
to testng...@googlegroups.com
By the way, this fix makes it so that time outs specified in code (@Test(timeOut=...)) will take precedence over XML.

I'm having a few second thoughts on that.

What does everyone think?

-- 
Cédric

Ryan Morgan

unread,
Sep 9, 2008, 2:11:09 PM9/9/08
to testng-users

I just double checked, and I can't get it working with either the
<test> or the <suite>.

I'm running my tests via ant if that matters:

[testng] Timeout test

[testng] ===============================================
[testng] Timeout Tests
[testng] Total tests run: 1, Failures: 0, Skips: 0
[testng] ===============================================

I know that the correct JAR is getting used as now my tests include a
Jar Suite which was just recently added. Can you point me to the SVN
commit that fixed this? I think I have the most recent code from
trunk, but I still don't see any logic in the parser to handle this
case for <test> containers.

-Ryan

On Sep 9, 10:55 am, Cédric Beust ♔ <cbe...@google.com> wrote:
> This is exactly the test that I used (I also tested with putting the
> time-out in <suite>). Can you double check? This test should fail, what
> are you seeing?
> --
> ***Cédric
> *

Cédric Beust ♔

unread,
Sep 9, 2008, 2:14:18 PM9/9/08
to testng...@googlegroups.com
Ryan, let's take this offline, please email me directly at cbeust at google.

-- 
Cédric

Cédric Beust ♔

unread,
Sep 9, 2008, 3:41:46 PM9/9/08
to testng...@googlegroups.com
We figured it out, I had uploaded the wrong jar file.  This bug now appears to be fixed.

-- 
Cédric

Nazar Stasiv

unread,
Oct 17, 2008, 10:41:52 AM10/17/08
to testng-users
which version fixes time-out attribute for the suite element?

On 9 Вер, 22:41, Cédric Beust ♔ <cbe...@google.com> wrote:
> We figured it out, I had uploaded the wrong jar file.  This bug now appears
> to be fixed.
> --
> ***Cédric
> *
>
> On Tue, Sep 9, 2008 at 11:14 AM, Cédric Beust ♔ <cbe...@google.com> wrote:
>
> > Ryan, let's take this offline, please email me directly at cbeust at
> > google.
> > --
> > ***Cédric
> > *

Cédric Beust ♔

unread,
Oct 17, 2008, 11:50:11 AM10/17/08
to testng...@googlegroups.com
5.8.1 beta, I posted the link in my previous message.

--
Cedric

--
Cédric


Cédric Beust ♔

unread,
Oct 17, 2008, 11:51:21 AM10/17/08
to testng...@googlegroups.com
I think there is a misunderstanding:  this version fixes the time out issue in <test>.  Time outs at the suite level are not supported.

--
Cedric

--
Cédric


KUMAR P

unread,
Apr 25, 2019, 2:26:16 AM4/25/19
to testng-users
I am having more than on classes in testng.xml and when i am trying to setting the priority i am getting an error . priority should set a class level 
 <class name = "package1.Sprint1Tests.javaclass " priority=1/>

⇜Krishnan Mahadevan⇝

unread,
May 6, 2019, 1:23:24 PM5/6/19
to testng...@googlegroups.com
Please help add more context to the issue you are facing.

1. What version of TestNG are you using? [ Make sure you are using TestNG 7.0.0-beta5 ]
2. Please share a sample test project which can be used to reproduce the problem.
3. Any other additional details you can provide, which will help more in terms of figuring out what is going wrong.


Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribblings @ https://rationaleemotions.com/


--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testng-users...@googlegroups.com.
To post to this group, send email to testng...@googlegroups.com.
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.

Abhishek Sawai

unread,
May 8, 2019, 6:08:59 AM5/8/19
to testng...@googlegroups.com
*Starting next Selenium Batch soon* ‼️

Now transform yourself into a *Selenium Automation Expert*

✅ Learn from Industry Experts
✅ Learn JAVA & Selenium from scratch
✅ Course duration 2 months
👉🏻 *Classroom* - Saturday (3hrs) and Sunday (3hrs)
👉🏻 *Online* - Mon,Tues,Wed,Thurs.
✅ Interview Preparation
📣 *First 2⃣ sessions are free*

*Course Contents*:-
Core Java,
Selenium ( Basic + Advanced), TestNG, Industry Standard Framework (Page Object Model) With Data Provider, Maven,Jenkins,BDD cucumber.

📅 *Starting from?*
⏰ First week of next month

🏢 *Where ?* 
*Online* ➖join from your *favourite place*
*Classroom* ➖Wadgaon sheri, PUNE

👫 *Who can attain* 
✅ * who want to become Automation Tester*

📞 *For Registration Whatapp or message your*
👉🏻 *Name-*
👉🏻 *Mobile-*
👉🏻 *Company -*
👉🏻 *Location-*
👉🏻 *Exp-*
👉🏻 *online / classroom-*
to *Abhishek* *+919403115588*

Regards, 
*Abhishek Sawai*
--
Regards,
Abhishek
9403115588

Krishnan Mahadevan

unread,
May 8, 2019, 6:17:24 AM5/8/19
to testng...@googlegroups.com
Please refrain from using this forum for these kind of promotional posts!

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"

Abhishek Sawai

unread,
May 8, 2019, 6:18:30 AM5/8/19
to testng...@googlegroups.com
Sure going forward i will take care

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testng-users...@googlegroups.com.
To post to this group, send email to testng...@googlegroups.com.
Visit this group at https://groups.google.com/group/testng-users.

For more options, visit https://groups.google.com/d/optout.
--
Regards,
Abhishek
9403115588
Reply all
Reply to author
Forward
0 new messages