Display error in form and refactor tests