summaryrefslogtreecommitdiff
path: root/test-cli/test/runners/simple.py
diff options
context:
space:
mode:
Diffstat (limited to 'test-cli/test/runners/simple.py')
-rw-r--r--test-cli/test/runners/simple.py41
1 files changed, 24 insertions, 17 deletions
diff --git a/test-cli/test/runners/simple.py b/test-cli/test/runners/simple.py
index 2eb61a4..ece5a4e 100644
--- a/test-cli/test/runners/simple.py
+++ b/test-cli/test/runners/simple.py
@@ -5,6 +5,7 @@ Simple Test Runner for unittest module
import sys
import unittest
+from test.helpers.iseelogger import logObj
class SimpleTestRunner:
@@ -59,28 +60,34 @@ class TextTestResult(unittest.TestResult):
def addError(self, test, err):
unittest.TestResult.addError(self, test, err)
- # test.longMessage = err[1]
+ test.longMessage = err[1]
self.result = self.ERROR
- print(err[1])
+ print(err)
def addFailure(self, test, err):
unittest.TestResult.addFailure(self, test, err)
test.longMessage = err[1]
self.result = self.FAIL
+ logObj.getlogger().info('{}:{}'.format(test, err))
def stopTest(self, test):
- unittest.TestResult.stopTest(self, test)
- # display: print test result
- self.runner.writeUpdate(self.result)
- # save result data
- for result in test.getresults():
- self.__pgObj.upload_result_file(test.params["testidctl"], test.params["testid"],
- result["description"], result["filepath"], result["mimetype"])
- # SEND TO DB THE RESULT OF THE TEST
- if self.result == self.PASS:
- status = "TEST_COMPLETE"
- resulttext = test.gettextresult()
- else:
- status = "TEST_FAILED"
- resulttext = test.longMessage
- self.__pgObj.finish_test(test.params["testidctl"], test.params["testid"], status, resulttext)
+ try:
+ unittest.TestResult.stopTest(self, test)
+ # display: print test result
+ self.runner.writeUpdate(self.result)
+ # save result data
+ for result in test.getresults():
+ self.__pgObj.upload_result_file(test.params["testidctl"], test.params["testid"],
+ result["description"], result["filepath"], result["mimetype"])
+ # SEND TO DB THE RESULT OF THE TEST
+ if self.result == self.PASS:
+ status = "TEST_COMPLETE"
+ resulttext = test.gettextresult()
+ logObj.getlogger().info('{}:{}:{}:{}'.format(test.params["testidctl"], test.params["testid"], status, resulttext))
+ else:
+ status = "TEST_FAILED"
+ resulttext = test.longMessage
+ logObj.getlogger().info('{}:{}:{}:{}'.format(test.params["testidctl"], test.params["testid"], status, resulttext))
+ self.__pgObj.finish_test(test.params["testidctl"], test.params["testid"], status, resulttext)
+ except Exception as E:
+ logObj.getlogger().error('Exception: [{}]{}:{}:{}:{}'.format(E, test.params["testidctl"], test.params["testid"], status, resulttext)) \ No newline at end of file