diff --git a/README.md b/README.md index b7a1f2a..28c76dc 100644 --- a/README.md +++ b/README.md @@ -131,6 +131,11 @@ Output: C:\Users\Thomas\SourceTree\TestUp2\tests\results.json # Overriding where the .log files from a test run will be saved. LogPath: C:\Users\Thomas\SourceTree\TestUp2\logs +# Optional: +# Path to a .log file that will be used if TestUp itself runs into any errors +# while running the tests. +ErrorLogPath: C:\Users\Thomas\SourceTree\TestUp2\testup_errors.log + # Optional: # Overriding where the .run files from a test run will be saved. SavedRunsPath: C:\Users\Thomas\SourceTree\TestUp2\logs diff --git a/src/testup/app.rb b/src/testup/app.rb index b6f7302..88cc2a4 100644 --- a/src/testup/app.rb +++ b/src/testup/app.rb @@ -28,7 +28,17 @@ def self.process_arguments # @param [Hash] config def self.ci_run(test_suite, config = {}) Execution.delay(1.0) do - API.run_suite_without_gui(test_suite, config) + begin + API.run_suite_without_gui(test_suite, config) + rescue Exception => error + # Ensure we log the error to a file so the CI system can log it. + if config['ErrorLogPath'] + File.open(config['ErrorLogPath'], 'w') { |file| + file.puts(error.inspect) + file.puts(error.backtrace.join("\n")) + } + end + end self.quit unless config['KeepOpen'] end end