Pull request feedback on test failure hook. Added tests and updated documentation.