Extract test code