I'm using Selendroid in order to test my app. At the beginning of each test I run adb shell screenrecord with the following function:
public static Process startScreenRecord(String fileName) throws IOException{
ProcessBuilder builder = new ProcessBuilder(
"cmd.exe", "/c", "cd C:\\Users\\user\\Downloads\\adt-bundle-windows-x86_64-20140702\\adt-bundle-windows-x86_64-20140702\\sdk\\platform-tools\\ && adb shell screenrecord /sdcard/" + fileName);
builder.redirectErrorStream(true);
Process p = builder.start();
return p;
}
The recording is starting and everything looks OK. At the end of each test I try to stop the record via the following code:
public static void stopScreenRecord(Process p) throws IOException{
p.destroy();
}
And in the test I use the following structure:
Process p = CmdHelper.startScreenRecord("e1.mp4");
//TestCode
CmdHelper.stopScreenRecord(p);
The problem is that the video recording doesn't stop. How can I stop the call recording at the end of each test?