Hi,
You can check here how I implemented test time checks. It is not timeout - it is time monitor and if the test takes too long it fails it. If your test hangs this will not help you.
Unfortunately monitoring the time tests take is a tricky thing, because every system hiccup could fail it. This is why I do this in two passes - on first I accumulate all tests that surpass the expected time, and then I run them again - to make sure if this is a tendency or hiccup.
You can avoid such problems if you use cpu cycles, but this will create some other issues.
Hope this helps.
Thanks,
George