90d635e3b35389258d5fb89e1d8ca96a429d071e
[platform/core/test/security-tests.git] / tests / framework / include / dpl / test / test_results_collector_html.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_html.h
18  * @author      Marcin Niesluchowski (m.niesluchow@samsung.com)
19  * @version     1.0
20  * @brief       Header file containing HtmlCollector class declaration
21  */
22
23 #ifndef DPL_TEST_RESULTS_COLLECTOR_HTML_H
24 #define DPL_TEST_RESULTS_COLLECTOR_HTML_H
25
26 #include <map>
27
28 #include <dpl/scoped_fclose.h>
29 #include <dpl/test/statistic.h>
30 #include <dpl/test/test_results_collector.h>
31
32 namespace DPL {
33 namespace Test {
34
35 class HtmlCollector :
36     public TestResultsCollectorBase
37 {
38 public:
39     static TestResultsCollectorBase* Constructor();
40
41 private:
42     HtmlCollector();
43
44     virtual std::string CollectorSpecificHelp() const;
45     virtual bool ParseCollectorSpecificArg(const std::string& arg);
46     virtual bool Configure();
47     virtual void Start();
48     virtual void CollectCurrentTestGroupName(const std::string& name);
49     virtual void CollectResult(const std::string& id,
50                                const FailStatus status = FailStatus::NONE,
51                                const std::string& reason = "",
52                                const bool& isPerformanceTest = false,
53                                const std::chrono::system_clock::duration& performanceTime
54                                    = std::chrono::microseconds::zero(),
55                                const std::chrono::system_clock::duration& performanceMaxTime
56                                    = std::chrono::microseconds::zero());
57     virtual void Finish();
58
59     void PrintfErrorMessage(const char* type,
60                             const std::string& message,
61                             bool verbosity);
62     void PrintfIgnoredMessage(const char* type,
63                               const std::string& message,
64                               bool verbosity);
65     void PrintStats(const std::string& name, const Statistic& stats);
66
67     std::string m_filename;
68     ScopedFClose m_fp;
69     Statistic m_stats;
70     std::string m_currentGroup;
71     std::map<std::string, Statistic> m_groupsStats;
72 };
73
74 } // namespace Test
75 } // namespace DPL
76
77 #endif // DPL_TEST_RESULTS_COLLECTOR_HTML_H