Refactordeploy

Pulled the deploy listener registration out of onTested. Now on tested checks for test failure to unregister the deploy listener (if one was registered)