Add tests for pre-finish hook
Call the before-finish hook if it exists