Time limit to execute a test

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Time limit to execute a test

HilaireFernandes
Hi,

I have a test taking more than the 10 seconds limit to execute completely.

I tried to adjust this limit but failed to get it taken in
consideration. I tried from 3 places:

- in the test method itself

- in TestCase setUp

- in a dedicated TestResources

The adjustment seems to alway been too late, the limit is still at 10s.

To adjust the limit I did as following, for example in a dedicated
TestResource:

setUp
     "Some recursive scripts need more time to execute completely"
     defaultTimeLimitBackup := TestCase defaultTimeLimit.
     TestCase defaultTimeLimit: 60 seconds.

tearDown
     TestCase defaultTimeLimit: defaultTimeLimitBackup

 From the debugger raised at the test fail, I can see the
DefaultTimeLimit is correctly set to 60s.

If I adjust this time limit before executing test case, for example from
the settings browser, it is going fine. But I will prefer adjust it
programmatically.

Any idea?

Thanks

Hilaire

--
Dr. Geo
http://drgeo.eu



Reply | Threaded
Open this post in threaded view
|

Re: Time limit to execute a test

CyrilFerlicot

On sam. 21 avr. 2018 at 11:55, Hilaire <[hidden email]> wrote:
Hi,

I have a test taking more than the 10 seconds limit to execute completely.

I tried to adjust this limit but failed to get it taken in
consideration. I tried from 3 places:

- in the test method itself

- in TestCase setUp

- in a dedicated TestResources

The adjustment seems to alway been too late, the limit is still at 10s.

To adjust the limit I did as following, for example in a dedicated
TestResource:

setUp
     "Some recursive scripts need more time to execute completely"
     defaultTimeLimitBackup := TestCase defaultTimeLimit.
     TestCase defaultTimeLimit: 60 seconds.

tearDown
     TestCase defaultTimeLimit: defaultTimeLimitBackup

 From the debugger raised at the test fail, I can see the
DefaultTimeLimit is correctly set to 60s.

If I adjust this time limit before executing test case, for example from
the settings browser, it is going fine. But I will prefer adjust it
programmatically.

Any idea?

Hi,

I don't have a computer to check but inside the test you should be able to call a method as #timeLimit:. I'm not sure of the name.

Also, if you want to raise the time limit of all the tests of the class, you don't need to call #defaultTimeLimit: but you need to override #defaultTimeLimit. 


Thanks

Hilaire

--
Dr. Geo
http://drgeo.eu



--
Cyril Ferlicot
https://ferlicot.fr
Reply | Threaded
Open this post in threaded view
|

Re: Time limit to execute a test

HilaireFernandes
Ah yes, it does it.

Thanks


Le 21/04/2018 à 11:58, Cyril Ferlicot a écrit :
> I don't have a computer to check but inside the test you should be
> able to call a method as #timeLimit:. I'm not sure of the name.
>

--
Dr. Geo
http://drgeo.eu