From db3b1e45c47a1ef23c1ad67114a09cbec0976681 Mon Sep 17 00:00:00 2001 From: Hector Fernandez Date: Thu, 25 Jun 2020 11:45:31 +0200 Subject: Solved bugs. Adapted to DB changes. --- test-cli/test/tests/qserial.py | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) (limited to 'test-cli/test/tests/qserial.py') 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 -- cgit v1.1