timeOut

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

timeOut

b.l.srinivasulu
  Hello Everyone,

 @Test(timeOut = 2000)
    public void timeOutTest() {

    }


Here we gave timeOut for the method timeOutTest() as 20 milliseconds. Is there a chance to print that this method has taken more time by using timeOut.
like if timeOut is > 20 milliseconds. System.out.Println("timeOutTest method has taken more time than 20 ms"); with out using Exception handling.







--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: timeOut

Panikera
Hi Srinivas,

I am not sure it will print time in seconds. But you can put timer if you want to verify.


Regards,
-- Panikera


On Tue, Aug 5, 2014 at 7:42 PM, <[hidden email]> wrote:
  Hello Everyone,

 @Test(timeOut = 2000)
    public void timeOutTest() {

    }


Here we gave timeOut for the method timeOutTest() as 20 milliseconds. Is there a chance to print that this method has taken more time by using timeOut.
like if timeOut is > 20 milliseconds. System.out.Println("timeOutTest method has taken more time than 20 ms"); with out using Exception handling.







--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: timeOut

Andrew McElroy
In reply to this post by b.l.srinivasulu
You can do it in your listener.  

    @Override
   
public void onTestFailure(ITestResult tr) {
       
if (tr.getEndMillis() - tr.getStartMillis() >= tr.getMethod().getTimeOut()) {
           
System.out.println("timeOutTest method has taken more time than " + tr.getMethod().getTimeOut() + "ms");
       
}
   
}


On Tuesday, August 5, 2014 10:12:47 AM UTC-4, [hidden email] wrote:
  Hello Everyone,

 @Test(timeOut = 2000)
    public void timeOutTest() {

    }


Here we gave timeOut for the method timeOutTest() as 20 milliseconds. Is there a chance to print that this method has taken more time by using timeOut.
like if timeOut is > 20 milliseconds. System.out.Println("timeOutTest method has taken more time than 20 ms"); with out using Exception handling.






<div class="line number17 index16 alt2" style="font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; line-height: 14.300000190734863px; color: rgb(125, 131, 136); padding-right: 1em !important; padding-left: 1em !important; width: auto !impor
...

--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: timeOut

b.l.srinivasulu
In reply to this post by b.l.srinivasulu
Thank you very much Andrew this solves the problem.

--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.