Test engine refactoring