Extract hierarchy for test classes