Remove unnecessary test result from test runner
[platform/core/test/security-tests.git] / src / framework / src / test_runner.cpp
index dd64968..b753cdd 100644 (file)
@@ -243,7 +243,7 @@ bool TestRunner::filterByXML(std::map<std::string, bool> & casesMap)
     return true;
 }
 
-TestRunner::Status TestRunner::RunTestCase(const TestCaseStruct& testCase)
+void TestRunner::RunTestCase(const TestCaseStruct& testCase)
 {
     setCurrentTestCase(&(const_cast<TestCaseStruct &>(testCase)));
     try {
@@ -251,47 +251,41 @@ TestRunner::Status TestRunner::RunTestCase(const TestCaseStruct& testCase)
     } catch (const TestFailed &e) {
         // Simple test failure
         CollectResult(testCase.name,
-                      TestResultsCollectorBase::FailStatus::FAILED,
-                      getConcatedFailReason(e.GetMessage()));
+                      TestResult(TestResult::FailStatus::FAILED,
+                                 getConcatedFailReason(e.GetMessage())));
 
         setCurrentTestCase(nullptr);
-        return FAILED;
+        return;
     } catch (const Ignored &e) {
         if (m_runIgnored) {
             // Simple test have to be implemented
             CollectResult(testCase.name,
-                          TestResultsCollectorBase::FailStatus::IGNORED,
-                          e.GetMessage());
+                          TestResult(TestResult::FailStatus::IGNORED, e.GetMessage()));
         }
 
         setCurrentTestCase(nullptr);
-        return IGNORED;
+        return;
     } catch (const std::exception &) {
         // std exception failure
         CollectResult(testCase.name,
-                      TestResultsCollectorBase::FailStatus::FAILED,
-                      "std exception");
+                      TestResult(TestResult::FailStatus::FAILED, "std exception"));
 
         setCurrentTestCase(nullptr);
-        return FAILED;
+        return;
     } catch (...) {
         // Unknown exception failure
         CollectResult(testCase.name,
-                      TestResultsCollectorBase::FailStatus::FAILED,
-                      "unknown exception");
-
+                      TestResult(TestResult::FailStatus::FAILED, "unknown exception"));
         setCurrentTestCase(nullptr);
-        return FAILED;
+        return;
     }
 
+    // Everything OK
     CollectResult(testCase.name,
-                  TestResultsCollectorBase::FailStatus::NONE,
-                  std::string(),
-                  testCase.performance);
+                  TestResult(TestResult::FailStatus::NONE,
+                             std::string(),
+                             testCase.performance));
     setCurrentTestCase(nullptr);
-
-    // Everything OK
-    return PASS;
 }
 
 void TestRunner::RunTests()
@@ -411,20 +405,13 @@ std::string TestRunner::getConcatedFailReason(const std::string &reason)
     return reason + ret;
 }
 
-void TestRunner::CollectResult(
-    const std::string& id,
-    const TestResultsCollectorBase::FailStatus status,
-    const std::string& reason,
-    const ConstPerformanceResultPtr &performance)
+void TestRunner::CollectResult(const std::string& id, const TestResult& result)
 {
     std::for_each(m_collectors.begin(),
                   m_collectors.end(),
                   [&](const TestResultsCollectors::value_type & collector)
                   {
-                      collector.second->CollectResult(id,
-                                                      status,
-                                                      reason,
-                                                      performance);
+                      collector.second->CollectResult(id, result);
                   });
 }