Refactor test definition, running and reporting