f0edfccb84602d14ba3536877231e5727ed67c95
[platform/core/test/security-tests.git] / src / framework / include / dpl / test / test_results_collector_summary.h
1 /*
2  * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  *    Licensed under the Apache License, Version 2.0 (the "License");
5  *    you may not use this file except in compliance with the License.
6  *    You may obtain a copy of the License at
7  *
8  *        http://www.apache.org/licenses/LICENSE-2.0
9  *
10  *    Unless required by applicable law or agreed to in writing, software
11  *    distributed under the License is distributed on an "AS IS" BASIS,
12  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  *    See the License for the specific language governing permissions and
14  *    limitations under the License.
15  */
16 /*
17  * @file        test_results_collector_summary.h
18  * @author      Marcin Niesluchowski (m.niesluchow@samsung.com)
19  * @author      Michal Witanowski (m.witanowski@samsung.com)
20  * @version     1.0
21  * @brief       Header file containing SummaryCollector class declaration.
22  */
23
24 #ifndef DPL_TEST_RESULTS_COLLECTOR_SUMMARY_H
25 #define DPL_TEST_RESULTS_COLLECTOR_SUMMARY_H
26
27 #include <fstream>
28 #include <string>
29
30 #include <dpl/test/statistic.h>
31 #include <dpl/test/test_results_collector.h>
32
33 namespace DPL {
34 namespace Test {
35
36 class SummaryCollector
37     : public TestResultsCollectorBase
38 {
39 public:
40     static TestResultsCollectorBase* Constructor();
41
42 private:
43     SummaryCollector();
44
45     virtual std::string CollectorSpecificHelp() const;
46     virtual bool ParseCollectorSpecificArg(const std::string& arg);
47     virtual void Start();
48     virtual void CollectResult(const std::string& id,
49                                const FailStatus status = FailStatus::NONE,
50                                const std::string& reason = "",
51                                const bool& isPerformanceTest = false,
52                                const std::chrono::system_clock::duration& performanceTime
53                                    = std::chrono::microseconds::zero(),
54                                const std::chrono::system_clock::duration& performanceMaxTime
55                                    = std::chrono::microseconds::zero());
56     virtual void Finish();
57
58     void writeStats(bool segfault);
59
60     Statistic m_stats;
61     std::string m_filename;
62     std::ofstream m_output;
63 };
64
65 } // namespace Test
66 } // namespace DPL
67
68 #endif // DPL_TEST_RESULTS_COLLECTOR_SUMMARY_H