Add --no-verbose option to HTML collector
[platform/core/test/security-tests.git] / src / framework / src / test_results_collector_html.cpp
index 0ca0475..ee76c49 100644 (file)
@@ -39,7 +39,8 @@ const char *DEFAULT_HTML_FILE_NAME = "index.html";
 }
 
 HtmlCollector::HtmlCollector()
-    : m_filename(DEFAULT_HTML_FILE_NAME)
+    : m_filename(DEFAULT_HTML_FILE_NAME),
+      m_verbosity(true)
 {
 }
 
@@ -66,7 +67,7 @@ bool HtmlCollector::Configure()
 
 std::string HtmlCollector::CollectorSpecificHelp() const
 {
-    return CollectorFileHelp(DEFAULT_HTML_FILE_NAME);
+    return CollectorFileHelp(DEFAULT_HTML_FILE_NAME) + COLLECTOR_NO_VERBOSE_HELP;
 }
 
 void HtmlCollector::Start()
@@ -101,7 +102,7 @@ void HtmlCollector::Finish()
 
 bool HtmlCollector::ParseCollectorSpecificArg(const std::string& arg)
 {
-    return ParseCollectorFileArg(arg, m_filename);
+    return ParseCollectorFileArg(arg, m_filename) || ParseCollectorNoVerboseArg(arg, m_verbosity);
 }
 
 void HtmlCollector::CollectResult(const std::string& id,
@@ -137,10 +138,10 @@ void HtmlCollector::CollectResult(const std::string& id,
         fprintf(m_fp.Get(), GREEN_RESULT_OK);
         break;
     case FailStatus::FAILED:
-        PrintfErrorMessage(" FAILED ", reason, true);
+        PrintfErrorMessage(" FAILED ", reason);
         break;
     case FailStatus::IGNORED:
-        PrintfIgnoredMessage("Ignored ", reason, true);
+        PrintfIgnoredMessage("Ignored ", reason);
         break;
     default:
         Assert(false && "Bad status");
@@ -149,51 +150,41 @@ void HtmlCollector::CollectResult(const std::string& id,
     m_stats.AddTest(status);
 }
 
-void HtmlCollector::PrintfErrorMessage(const char* type,
-                                       const std::string& message,
-                                       bool verbosity)
+void HtmlCollector::PrintfErrorMessage(const char* type, const std::string& message)
 {
     using namespace DPL::Colors::Html;
-    if (verbosity) {
+    fprintf(m_fp.Get(),
+            "[%s%s%s]",
+            BOLD_RED_BEGIN,
+            type,
+            BOLD_RED_END);
+    if (m_verbosity) {
         fprintf(m_fp.Get(),
-                "[%s%s%s] %s%s%s\n",
-                BOLD_RED_BEGIN,
-                type,
-                BOLD_RED_END,
+                " %s%s%s",
                 BOLD_YELLOW_BEGIN,
                 message.c_str(),
                 BOLD_YELLOW_END);
-    } else {
-        fprintf(m_fp.Get(),
-                "[%s%s%s]\n",
-                BOLD_RED_BEGIN,
-                type,
-                BOLD_RED_END);
     }
+    fprintf(m_fp.Get(), "\n");
 }
 
-void HtmlCollector::PrintfIgnoredMessage(const char* type,
-                                         const std::string& message,
-                                         bool verbosity)
+void HtmlCollector::PrintfIgnoredMessage(const char* type, const std::string& message)
 {
     using namespace DPL::Colors::Html;
 
-    if (verbosity) {
+    fprintf(m_fp.Get(),
+            "[%s%s%s]",
+            CYAN_BEGIN,
+            type,
+            CYAN_END);
+    if (m_verbosity) {
         fprintf(m_fp.Get(),
-                "[%s%s%s] %s%s%s\n",
-                CYAN_BEGIN,
-                type,
-                CYAN_END,
+                " %s%s%s",
                 BOLD_GOLD_BEGIN,
                 message.c_str(),
                 BOLD_GOLD_END);
-    } else {
-        fprintf(m_fp.Get(),
-                "[%s%s%s]\n",
-                CYAN_BEGIN,
-                type,
-                CYAN_END);
     }
+    fprintf(m_fp.Get(), "\n");
 }
 
 void HtmlCollector::PrintStats(const std::string& name, const Statistic& stats)