Added error handling in test running.