Refactors building of tests