Waiting for a fixed time raises the problem that the time you choose is either short (build failures) or long (waste of build time). So I think it would be better to check if the application is available.
I did something similar for my Selenium tests. I had to wait until the Selenium Remote Server started. I used the item waitfor. For detailed documentation see here .
Here is a stripped down version of my ant-Target:
<parallel>
<sequential>
... Start web application server ...
</sequential>
<sequential>
<waitfor maxwait="10" maxwaitunit="minute">
<socket server="localhost" port="8080" />
</waitfor>
<junit>
...
</junit>
</sequential>
</parallel>
If your server is available before deploying the web application, you can try to use the condition httpinstead socketto check the HTTP error code. The conditions are described here .
source
share