Refactored tests framework code.