Tests: extract test utilities from core tests