Throw TestFailedOnTimeoutException instead of plain Exception on timeout. Fixes #771

Created a separate branch with the changes I've made and fully merged from upstream/master. This one should probably merge better than the newline-broken tree in PR #777