Add code to separate out stdout and stderr in testing

Previously the output of these was merged by redirection.

Signed-off-by: Martin O. Pollard <mp15@sanger.ac.uk>
Test merge code

Add tests for merge code

Signed-off-by: Martin O. Pollard <mp15@sanger.ac.uk>