From 9626677f193924a046074bfd495a627ab61f7a46 Mon Sep 17 00:00:00 2001 From: Lukasz Wojciechowski Date: Thu, 16 Oct 2014 19:10:49 +0200 Subject: [PATCH] Add RUNNER_ERROR_MSG(message) macro Macro can be used to print error messages during test runtime. Sometimes there is a need to print out important information that are related to error that happen during test run, but it is impossible to do that with RUNNER_ASSERT... macros because an exception is alredy thrown. Change-Id: I574af27bba7c20f21e2c6f9fc0b808f7ed9675ed --- README | 8 ++++++++ tests/framework/include/dpl/test/test_runner.h | 15 ++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/README b/README index 7b277c5..9caea47 100644 --- a/README +++ b/README @@ -140,6 +140,14 @@ dpl-test-framework RUNNER_PERF_TEST_END End time measurement. +--Message macros--------------------------------------------------------------- +Used to print error messages during test run time. + +dpl-test-framework + test_runner.h + RUNNER_ERROR_MSG + Print error message using red color. + --Collectors------------------------------------------------------------------- Collectors are classes which collect test results. Each class does it differently. Collectors can be registered by --output parameter (see HOW TO RUN section) but diff --git a/tests/framework/include/dpl/test/test_runner.h b/tests/framework/include/dpl/test/test_runner.h index 3f9ff7b..de7abb9 100644 --- a/tests/framework/include/dpl/test/test_runner.h +++ b/tests/framework/include/dpl/test/test_runner.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,6 +26,7 @@ #include #include +#include #include #include #include @@ -35,6 +36,7 @@ #include #include +#include #include #include #include @@ -327,5 +329,16 @@ typedef DPL::Singleton TestRunnerSingleton; DPL::Test::TestRunnerSingleton::Instance().endPerformanceTestTime(); \ } while (0) +/** + * MSG MACROS + * + * Use these macros to print error messages during test run time + */ + +#define RUNNER_ERROR_MSG(message) \ + do { \ + std::cerr << DPL::Colors::Text::RED_BEGIN << message \ + << DPL::Colors::Text::RED_END << std::endl; \ + } while (0) #endif // DPL_TEST_RUNNER_H -- 2.7.4