diff options
Diffstat (limited to 'tests/framework/Framework.cpp')
-rw-r--r-- | tests/framework/Framework.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/framework/Framework.cpp b/tests/framework/Framework.cpp index 9a67cca184..318f9b1d4c 100644 --- a/tests/framework/Framework.cpp +++ b/tests/framework/Framework.cpp @@ -216,6 +216,16 @@ bool Framework::stop_on_error() const return _stop_on_error; } +void Framework::set_error_on_missing_assets(bool error_on_missing_assets) +{ + _error_on_missing_assets = error_on_missing_assets; +} + +bool Framework::error_on_missing_assets() const +{ + return _error_on_missing_assets; +} + void Framework::run_test(const TestInfo &info, TestCaseFactory &test_factory) { if(test_factory.status() == TestCaseFactory::Status::DISABLED) @@ -269,6 +279,33 @@ void Framework::run_test(const TestInfo &info, TestCaseFactory &test_factory) result.status = TestResult::Status::SUCCESS; } } + catch(const FileNotFound &error) + { + if(_error_on_missing_assets) + { + if(_log_level >= LogLevel::ERRORS && _printer != nullptr) + { + TestError test_error(error.what(), LogLevel::ERRORS); + _printer->print_error(test_error, is_expected_failure); + } + + result.status = TestResult::Status::FAILED; + + if(_throw_errors) + { + throw; + } + } + else + { + if(_log_level >= LogLevel::DEBUG && _printer != nullptr) + { + _printer->print_info(error.what()); + } + + result.status = TestResult::Status::NOT_RUN; + } + } catch(const TestError &error) { if(_log_level >= error.level() && _printer != nullptr) |