Tizen 2.0 Release
[framework/web/wrt-commons.git] / modules / test / include / dpl / test / test_runner.h
index ab1a626..a4db750 100644 (file)
@@ -32,6 +32,7 @@
 #include <vector>
 #include <list>
 #include <set>
+#include <map>
 
 namespace DPL
 {
@@ -39,9 +40,12 @@ namespace Test
 {
 class TestRunner
 {
-    TestResultsCollectorBasePtr m_collector;
-    std::string m_collectorName;
+    typedef std::map<std::string, TestResultsCollectorBasePtr>
+            TestResultsCollectors;
+    TestResultsCollectors m_collectors;
+
     std::string m_startTestId;
+    bool m_runIgnored;
 
 public:
     typedef void (*TestCase)();
@@ -82,15 +86,21 @@ private:
     DPL::Atomic m_totalAssertions;
 
     void Banner();
-    void InvalidArgs();
+    void InvalidArgs(const std::string& message = "Invalid arguments!");
     void Usage();
 
-    enum Status { FAILED, TODO, IGNORED, PASS };
+    enum Status { FAILED, IGNORED, PASS };
 
     Status RunTestCase(const TestCaseStruct& testCase);
 
     void RunTests();
 
+    void CollectResult(const std::string& id,
+                       const std::string& description,
+                       const TestResultsCollectorBase::FailStatus::Type status
+                           = TestResultsCollectorBase::FailStatus::NONE,
+                       const std::string& reason = std::string());
+
 public:
     class TestFailed
     {
@@ -116,27 +126,6 @@ public:
         }
     };
 
-    class ToDo
-    {
-    private:
-        std::string m_message;
-
-    public:
-        ToDo()
-        {
-        }
-
-        ToDo(const std::string &message)
-            : m_message(message)
-        {
-        }
-
-        std::string GetMessage() const
-        {
-            return m_message;
-        }
-    };
-
     class Ignored
     {
     private:
@@ -166,6 +155,7 @@ public:
     int ExecTestRunner(int argc, char *argv[]);
     typedef std::vector<std::string> ArgsList;
     int ExecTestRunner(const ArgsList& args);
+    bool getRunIgnored() const;
 };
 
 typedef DPL::Singleton<TestRunner> TestRunnerSingleton;
@@ -211,8 +201,6 @@ do
 
 #define RUNNER_FAIL RUNNER_ASSERT(false)
 
-#define RUNNER_TODO_MSG(message) do { std::ostringstream assertMsg; assertMsg << message; throw DPL::Test::TestRunner::ToDo(assertMsg.str()); } while (0)
-
 #define RUNNER_IGNORED_MSG(message) do { std::ostringstream assertMsg; assertMsg << message; throw DPL::Test::TestRunner::Ignored(assertMsg.str()); } while (0)
 
 #endif // DPL_TEST_RUNNER_H