java - What are the factors to calculate a timeout value for a test case in junit -
public class junittimeout { @test(timeout = 100) public void infinity() { //some code test } }
what performance factors need consider give particular timeout value junit test case.
for example @test(timeout = 100)
how can give value timeout in here 100
i not use timeout
regular unit tests. these tests run on different computers, different os's, , different amount of other processes running. in turn make small "hickup" fail tests, , in many cases build (ant, maven). setting timeout close calling method takes become nuisance, halting build seemingly @ random.
what timeout
used integration tests, don't run @ each build. instance, if 1 has non-functional requirement stating webservice should have no more 2 seconds response time, test timeout of 2 seconds calls actual webservice run before deployment of new version, make sure requirement not broken.
edit: actually, found reason use timeout on regular unit tests. noticed tests in build taking lot of time, turned out tests of happened when soap-client couldn't connect, , tested trying call invalid url. problem there 20 second timeout, each build got took minute 3 tests. solved through creating methodrule
through, timeout can added once each class, rather in each test-method. so, identifying tests slow down build substantially use case this. i'll set timeout 3-5 seconds, above taking unecessary amount of time, , slow down build.
Comments
Post a Comment