Fix beforeTestMethod for test classes