Add query paremeter for TestResource to allow to specify a timeout on how long to wait for.
Fix minor issue when sleeping in TestResource