diff --git a/Chutzpah/Callbacks/ITestMethodRunnerCallback.cs b/Chutzpah/Callbacks/ITestMethodRunnerCallback.cs index e3fac279..d8a2350a 100644 --- a/Chutzpah/Callbacks/ITestMethodRunnerCallback.cs +++ b/Chutzpah/Callbacks/ITestMethodRunnerCallback.cs @@ -46,7 +46,7 @@ public interface ITestMethodRunnerCallback /// /// /// - void ExceptionThrown(Exception exception, string fileName); + void ExceptionThrown(Exception exception, string fileName=null); /// /// An error that occurred in a test file diff --git a/Chutzpah/Callbacks/RunnerCallback.cs b/Chutzpah/Callbacks/RunnerCallback.cs index d9921ffb..a891029a 100644 --- a/Chutzpah/Callbacks/RunnerCallback.cs +++ b/Chutzpah/Callbacks/RunnerCallback.cs @@ -64,9 +64,17 @@ protected virtual string GetFileLogMessage(TestLog log) return string.Format("Log Message: {0} from {1}\n", log.Message, log.InputTestFile); } - protected virtual string GetExceptionThrownMessage(Exception exception, string fileName) + protected virtual string GetExceptionThrownMessage(Exception exception, string fileName=null) { - return string.Format("Chutzpah Error: {0} - {1}\n While Running:{2}\n\n", exception.GetType().Name, exception, fileName); + if (!string.IsNullOrEmpty(fileName)) + { + return string.Format("Chutzpah Error: {0}\n While Running:{1}\n\n", exception, fileName); + } + else + { + + return string.Format("Chutzpah Error: {0}\n\n", exception); + } } public static string FormatFileErrorMessage(TestError error) diff --git a/Chutzpah/TestRunner.cs b/Chutzpah/TestRunner.cs index 284e6f75..4ad718eb 100644 --- a/Chutzpah/TestRunner.cs +++ b/Chutzpah/TestRunner.cs @@ -300,6 +300,11 @@ private bool PerformBatchCompile(ITestMethodRunnerCallback callback, IEnumerable { batchCompilerService.Compile(testContexts); } + catch (FileNotFoundException e) + { + callback.ExceptionThrown(e); + return false; + } catch (ChutzpahCompilationFailedException e) { callback.ExceptionThrown(e, e.SettingsFile);