Add --no-verbose option to XML collector 54/29054/14
authorMarcin Niesluchowski <m.niesluchow@samsung.com>
Thu, 16 Oct 2014 12:24:55 +0000 (14:24 +0200)
committerZbigniew Jasinski <z.jasinski@samsung.com>
Wed, 11 Mar 2015 15:10:58 +0000 (08:10 -0700)
With --no-verbose param fail/ignore reason is not displayed

Change-Id: I62c78186c4b560f409f66ad74be3a3f4005fda42

src/framework/include/dpl/test/test_results_collector_xml.h
src/framework/src/test_results_collector_xml.cpp

index 01b9802..16bfa5a 100644 (file)
@@ -65,12 +65,8 @@ private:
                                 const std::string& value);
     std::string UIntToString(const unsigned int value);
     void GroupFinish(const std::size_t groupPosition);
-    void PrintfErrorMessage(const char* type,
-                            const std::string& message,
-                            bool verbosity);
-    void PrintfIgnoredMessage(const char* type,
-                              const std::string& message,
-                              bool verbosity);
+    void PrintfErrorMessage(const char* type, const std::string& message);
+    void PrintfIgnoredMessage(const char* type, const std::string& message);
     void FlushOutput();
     std::string EscapeSpecialCharacters(std::string s);
 
@@ -79,6 +75,7 @@ private:
     Statistic m_stats;
     std::string m_outputBuffer;
     std::string m_resultBuffer;
+    bool m_verbosity;
 };
 
 } // namespace Test
index ed4a6e5..65f751e 100644 (file)
@@ -42,7 +42,7 @@ const char *DEFAULT_XML_FILE_NAME = "results.xml";
 }
 
 XmlCollector::XmlCollector()
-    : m_filename(DEFAULT_XML_FILE_NAME)
+    : m_filename(DEFAULT_XML_FILE_NAME), m_verbosity(true)
 {
 }
 
@@ -99,7 +99,7 @@ bool XmlCollector::Configure()
 
 std::string XmlCollector::CollectorSpecificHelp() const
 {
-    return CollectorFileHelp(DEFAULT_XML_FILE_NAME);
+    return CollectorFileHelp(DEFAULT_XML_FILE_NAME) + COLLECTOR_NO_VERBOSE_HELP;
 }
 
 void XmlCollector::Start()
@@ -121,7 +121,7 @@ void XmlCollector::Finish()
 
 bool XmlCollector::ParseCollectorSpecificArg(const std::string& arg)
 {
-    return ParseCollectorFileArg(arg, m_filename);
+    return ParseCollectorFileArg(arg, m_filename) || ParseCollectorNoVerboseArg(arg, m_verbosity);
 }
 
 void XmlCollector::CollectResult(const std::string& id,
@@ -162,13 +162,12 @@ void XmlCollector::CollectResult(const std::string& id,
         break;
     case FailStatus::FAILED:
         m_resultBuffer.append(" status=\"FAILED\">\n");
-        PrintfErrorMessage("FAILED", EscapeSpecialCharacters(reason), true);
+        PrintfErrorMessage("FAILED", EscapeSpecialCharacters(reason));
         m_resultBuffer.append("\t\t</testcase>\n");
         break;
     case FailStatus::IGNORED:
         m_resultBuffer.append(" status=\"Ignored\">\n");
-        PrintfIgnoredMessage("Ignored", EscapeSpecialCharacters(
-                                 reason), true);
+        PrintfIgnoredMessage("Ignored", EscapeSpecialCharacters(reason));
         m_resultBuffer.append("\t\t</testcase>\n");
         break;
     default:
@@ -299,38 +298,26 @@ void XmlCollector::FlushOutput()
     }
 }
 
-void XmlCollector::PrintfErrorMessage(const char* type,
-                                      const std::string& message,
-                                      bool verbosity)
+void XmlCollector::PrintfErrorMessage(const char* type, const std::string& message)
 {
-    if (verbosity) {
-        m_resultBuffer.append("\t\t\t<failure type=\"");
-        m_resultBuffer.append(EscapeSpecialCharacters(type));
+    m_resultBuffer.append("\t\t\t<failure type=\"");
+    m_resultBuffer.append(EscapeSpecialCharacters(type));
+    if (m_verbosity) {
         m_resultBuffer.append("\" message=\"");
         m_resultBuffer.append(EscapeSpecialCharacters(message));
-        m_resultBuffer.append("\"/>\n");
-    } else {
-        m_resultBuffer.append("\t\t\t<failure type=\"");
-        m_resultBuffer.append(EscapeSpecialCharacters(type));
-        m_resultBuffer.append("\"/>\n");
     }
+    m_resultBuffer.append("\"/>\n");
 }
 
-void XmlCollector::PrintfIgnoredMessage(const char* type,
-                                        const std::string& message,
-                                        bool verbosity)
+void XmlCollector::PrintfIgnoredMessage(const char* type, const std::string& message)
 {
-    if (verbosity) {
-        m_resultBuffer.append("\t\t\t<skipped type=\"");
-        m_resultBuffer.append(EscapeSpecialCharacters(type));
+    m_resultBuffer.append("\t\t\t<skipped type=\"");
+    m_resultBuffer.append(EscapeSpecialCharacters(type));
+    if (m_verbosity) {
         m_resultBuffer.append("\" message=\"");
         m_resultBuffer.append(EscapeSpecialCharacters(message));
-        m_resultBuffer.append("\"/>\n");
-    } else {
-        m_resultBuffer.append("\t\t\t<skipped type=\"");
-        m_resultBuffer.append(EscapeSpecialCharacters(type));
-        m_resultBuffer.append("\"/>\n");
     }
+    m_resultBuffer.append("\"/>\n");
 }
 
 std::string XmlCollector::EscapeSpecialCharacters(std::string s)