Easyuino  1.1.0
ManualTest.h
1 /*
2 MIT License
3 
4 Copyright (c) 2017 André Pires
5 
6 Permission is hereby granted, free of charge, to any person obtaining a copy
7 of this software and associated documentation files (the "Software"), to deal
8 in the Software without restriction, including without limitation the rights
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 copies of the Software, and to permit persons to whom the Software is
11 furnished to do so, subject to the following conditions:
12 
13 The above copyright notice and this permission notice shall be included in all
14 copies or substantial portions of the Software.
15 
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 SOFTWARE.
23 */
24 /*
25 ManualTest.h
26 */
27 #ifndef _MANUAL_TEST_h
28 #define _MANUAL_TEST_h
29 
30 #if defined(ARDUINO) && ARDUINO >= 100
31 #include <Arduino.h>
32 #else
33 #include "WProgram.h"
34 #endif
35 
36 #define TEST_FRAMEWORK_TAG "[Test Framework]"
37 #define TEST_NEW_TEST_MESSAGE "Test: "
38 #define TEST_SUITE_END_MESSAGE "Test Suite Ended"
39 #define DELAY_BETWEEN_TESTS 4000 // 4 seconds
40 
41 /* Base class for a set of tests on Arduino. Used to test Easyuino library components in real sensors/devices */
42 class ManualTest {
43 
44  private:
45  bool _testFinished;
46  protected:
47  Stream* _debugStream;
48 
49  public:
50  ManualTest(Stream& debugStream);
51 
52  void runTestsSetup();
53 
54  void runTests();
55 
56  protected:
57  virtual void testsSetup() = 0;
58 
59  virtual void tests() = 0;
60 
61  virtual void beforeTest();
62 
63  virtual void afterTest();
64 
65  virtual void afterTestSuite();
66 
67  void testStart(char* str);
68 
69  void testEnd(unsigned long delayAfterTestOverride = DELAY_BETWEEN_TESTS);
70 
71 };
72 
73 #endif
Definition: ManualTest.h:42