RobotTestingFramework 2.0.1
Robot Testing Framework
Loading...
Searching...
No Matches
WebProgressListener_impl.h
Go to the documentation of this file.
1/*
2 * Robot Testing Framework
3 *
4 * Copyright (C) 2015-2019 Istituto Italiano di Tecnologia (IIT)
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21
22#ifndef ROBOTTESTINGFRAMEWORK_WEBPROGRESSLISTENER_IMPL_H
23#define ROBOTTESTINGFRAMEWORK_WEBPROGRESSLISTENER_IMPL_H
24
25
27
28#include <mongoose.h>
29#include <mutex>
30#include <thread>
31
32namespace robottestingframework {
33
42{
43public:
51 static WebProgressListenerImpl& create(unsigned int port = 8080,
52 bool verbose = false);
53
58
65 virtual void addReport(const Test* test, TestMessage msg);
66
72 virtual void addError(const Test* test, TestMessage msg);
73
79 virtual void addFailure(const Test* test, TestMessage msg);
80
85 virtual void startTest(const Test* test);
86
91 virtual void endTest(const Test* test);
92
97 virtual void startTestSuite(const Test* test);
98
103 virtual void endTestSuite(const Test* test);
104
108 virtual void startTestRunner();
109
113 virtual void endTestRunner();
114
115public:
116 struct mg_server* server;
117 std::mutex critical;
119 std::string result;
120 std::string suite_name;
121 std::size_t suite_size;
122
123 enum class TestStatus
124 {
125 NotRun = 0,
126 Running = 1,
127 Failed = 2,
128 Success = 3
129 };
130
131 std::vector<TestStatus> testStatus;
132
133private:
135 void operator=(WebProgressListenerImpl const&) = delete;
136
138 bool verbose);
139 std::string encode(const std::string& data);
140 static void update(void* param);
141 static int handler(struct mg_connection* conn,
142 enum mg_event ev);
143
144private:
145 std::thread* updater;
147 unsigned int port;
148};
149
150} // namespace robottestingframework
151
152#endif // ROBOTTESTINGFRAMEWORK_WEBPROGRESSLISTENER_IMPL_H
A formated message with details.
Definition TestMessage.h:33
The simplest form of a test unit.
Definition Test.h:35
Singleton class WebProgressListenerImpl listens to any messages reported by the tests during the test...
static int handler(struct mg_connection *conn, enum mg_event ev)
virtual void endTestSuite(const Test *test)
This is called when a TestSuite is finished.
std::string encode(const std::string &data)
virtual void addError(const Test *test, TestMessage msg)
This is called when an error occurred during test run.
virtual void startTestSuite(const Test *test)
This is called when a TestSuite is started.
void operator=(WebProgressListenerImpl const &)=delete
WebProgressListenerImpl(unsigned int port, bool verbose)
virtual void addFailure(const Test *test, TestMessage msg)
This is called when a failure occurred during test run.
virtual void endTest(const Test *test)
This is called when a Test is finished.
static WebProgressListenerImpl & create(unsigned int port=8080, bool verbose=false)
create Creates an instance of WebProgressListenerImpl class
virtual void addReport(const Test *test, TestMessage msg)
This is called to report any arbitrary message from tests.
WebProgressListenerImpl(WebProgressListenerImpl const &)=delete
virtual void endTestRunner()
This is called when the TestRunner is finished.
virtual ~WebProgressListenerImpl()
WebProgressListenerImpl destructor.
virtual void startTest(const Test *test)
This is called when a Test is started.
virtual void startTestRunner()
This is called when the TestRunner is started.