X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fframework%2Finclude%2Fdpl%2Ftest%2Ftest_runner.h;fp=src%2Fframework%2Finclude%2Fdpl%2Ftest%2Ftest_runner.h;h=9da89df51652860e5c4c4c3698b8e9ba1a28b7d3;hb=89f2ab1b5f41c27e8b08dd27b4343778a991af0a;hp=53764bf999504b19811dceba002866fca651a370;hpb=80995bf6ca553e1c13800b7ab4eafbe14d932b29;p=platform%2Fcore%2Ftest%2Fsecurity-tests.git diff --git a/src/framework/include/dpl/test/test_runner.h b/src/framework/include/dpl/test/test_runner.h index 53764bf..9da89df 100644 --- a/src/framework/include/dpl/test/test_runner.h +++ b/src/framework/include/dpl/test/test_runner.h @@ -42,9 +42,11 @@ #include #include #include +#include #include #include #include +#include #include namespace DPL { @@ -69,14 +71,10 @@ class TestRunner , m_firstDeferredExceptionType(DeferredExceptionType::DEFERRED_FAILED) {} - void beginPerformanceTestTime(std::chrono::system_clock::duration maxTimeInMicroseconds); - void endPerformanceTestTime(); - void getCurrentTestCasePerformanceResult(bool& isPerformanceTest, - std::chrono::system_clock::duration& result, - std::chrono::system_clock::duration& resultMax); - void setCurrentTestCasePerformanceResult(bool isPerformanceTest, - std::chrono::system_clock::duration result, - std::chrono::system_clock::duration resultMax); + void beginPerformance(std::chrono::system_clock::duration maxDurationInMicroseconds); + void endPerformance(); + void setCurrentTestCasePerformanceResult(const PerformanceResultPtr &performance); + ConstPerformanceResultPtr getCurrentTestCasePerformanceResult(); void addFailReason(const std::string &reason); @@ -87,11 +85,7 @@ class TestRunner { std::string name; TestCase proc; - - bool m_isPerformanceTest; - std::chrono::system_clock::time_point m_performanceTestStartTime; - std::chrono::system_clock::duration m_performanceTestDurationTime; - std::chrono::system_clock::duration m_performanceMaxTime; + PerformanceResultPtr performance; bool operator <(const TestCaseStruct &other) const { @@ -105,8 +99,7 @@ class TestRunner TestCaseStruct(const std::string &n, TestCase p) : name(n), - proc(p), - m_isPerformanceTest(false) + proc(p) {} }; @@ -138,9 +131,7 @@ class TestRunner bool filterByXML(std::map & casesMap); void normalizeXMLTag(std::string& str, const std::string& testcase); - enum Status { FAILED, IGNORED, PASS }; - - Status RunTestCase(const TestCaseStruct& testCase); + void RunTestCase(const TestCaseStruct& testCase); void setCurrentTestCase(TestCaseStruct* testCase); TestCaseStruct *getCurrentTestCase(); @@ -149,13 +140,7 @@ class TestRunner std::string getConcatedFailReason(const std::string &reason); - void CollectResult(const std::string& id, - const TestResultsCollectorBase::FailStatus status - = TestResultsCollectorBase::FailStatus::NONE, - const std::string& reason = std::string(), - const bool& isPerformanceTest = false, - const std::chrono::system_clock::duration& performanceTime = std::chrono::microseconds::zero(), - const std::chrono::system_clock::duration& performanceMaxTime = std::chrono::microseconds::zero()); + void CollectResult(const std::string& id, const TestResult &result); public: void MarkAssertion(); @@ -305,13 +290,13 @@ typedef DPL::Singleton TestRunnerSingleton; #define RUNNER_PERF_TEST_BEGIN(maxTime) \ do { \ - DPL::Test::TestRunnerSingleton::Instance().beginPerformanceTestTime( \ + DPL::Test::TestRunnerSingleton::Instance().beginPerformance( \ std::chrono::microseconds{static_cast(maxTime*1000000.0)}); \ } while (0) -#define RUNNER_PERF_TEST_END() \ - do { \ - DPL::Test::TestRunnerSingleton::Instance().endPerformanceTestTime(); \ +#define RUNNER_PERF_TEST_END() \ + do { \ + DPL::Test::TestRunnerSingleton::Instance().endPerformance(); \ } while (0) /**