Screenrecord of androidTests

We’ve used screen recording locally to record our Android tests and are wondering whether/how we can start recording, run our tests and then end/capture the recording. Our concern is that we will not be able to continue after the screenrecord command without terminating the recording.