summaryrefslogtreecommitdiff
path: root/test-cli/test/tests/qserial.py
diff options
context:
space:
mode:
Diffstat (limited to 'test-cli/test/tests/qserial.py')
-rw-r--r--test-cli/test/tests/qserial.py29
1 files changed, 26 insertions, 3 deletions
diff --git a/test-cli/test/tests/qserial.py b/test-cli/test/tests/qserial.py
index 0cb5563..faca505 100644
--- a/test-cli/test/tests/qserial.py
+++ b/test-cli/test/tests/qserial.py
@@ -8,6 +8,7 @@ class Qserial(unittest.TestCase):
params = None
__port = None
__baudrate = None
+ __resultlist = None # resultlist is a python list of python dictionaries
# varlist: port, baudrate
def __init__(self, testname, testfunc, varlist):
@@ -23,6 +24,7 @@ class Qserial(unittest.TestCase):
else:
raise Exception('baudrate param inside Qserial must be defined')
self._testMethodDoc = testname
+ self.__resultlist = []
# open serial connection
self.__serial = serial.Serial(self.__port, self.__baudrate, timeout=1)
@@ -40,13 +42,34 @@ class Qserial(unittest.TestCase):
self.__serial.write(test_uuid)
time.sleep(0.05) # there might be a small delay
if self.__serial.inWaiting() == 0:
+ self.__resultlist.append(
+ {
+ "desc": "Test result",
+ "data": "FAILED: port {} wait timeout exceded".format(self.__port),
+ "type": "string"
+ }
+ )
self.fail("failed: port {} wait timeout exceded".format(self.__port))
else:
# check if what it was sent is equal to what has been received
if self.__serial.readline() != test_uuid:
+ self.__resultlist.append(
+ {
+ "desc": "Test result",
+ "data": "FAILED: port {} write/read mismatch".format(self.__port),
+ "type": "string"
+ }
+ )
self.fail("failed: port {} write/read mismatch".format(self.__port))
+ # Test successful
+ self.__resultlist.append(
+ {
+ "desc": "Test result",
+ "data": "OK",
+ "type": "string"
+ }
+ )
+
def getresults(self):
- # resultlist is a python list of python dictionaries
- resultlist = []
- return resultlist
+ return self.__resultlist