Test object information added to report

Šī revīzija ir iekļauta:
Dirk Alders 2023-02-09 16:01:04 +01:00
vecāks bd1966ed4f
revīzija 0d7b9c3903
9 mainīti faili ar 129186 papildinājumiem un 1721 dzēšanām

Parādīt failu

@ -5,7 +5,6 @@ from simulation.rooms import house
import sys import sys
from tests.all import test_smarthome from tests.all import test_smarthome
# TODO: Add testobject information (Info dict via mqtt) --> Report
# TODO: Extend tests in simulation # TODO: Extend tests in simulation
# - Switching button functions (gfw_dirk, ffe.sleep) # - Switching button functions (gfw_dirk, ffe.sleep)
# - Brightness button functions (gfw.dirk, ffe.sleep) # - Brightness button functions (gfw.dirk, ffe.sleep)
@ -27,7 +26,7 @@ if __name__ == "__main__":
for c in d.capabilities(): for c in d.capabilities():
COMMANDS.append(name + '.' + c) COMMANDS.append(name + '.' + c)
# #
ts = test_smarthome(h) ts = test_smarthome(h, mc)
for name in ts.getmembers(): for name in ts.getmembers():
d = ts.getobjbyname(name) d = ts.getobjbyname(name)
for c in d.capabilities(): for c in d.capabilities():
@ -92,4 +91,4 @@ if __name__ == "__main__":
else: else:
h.command(cmd) h.command(cmd)
del (ts) ts.close()

11
templates/object.tex Parasts fails
Parādīt failu

@ -0,0 +1,11 @@
{%- import 'macros.tex' as macros %}
\begin{tabu} to \linewidth {lX}
\toprule
{\bf Test object Information} & \\
\midrule
Test Object Name & {{macros.latex_filter(object_information.app_name)}} \\
Test Object Vesion & {{macros.latex_filter(object_information.version.readable)}} \\
GIT repository & {{macros.latex_filter(object_information.git.url)}}\\
GIT reference & {{macros.latex_filter(object_information.git.ref)}}\\
\bottomrule
\end{tabu}

Parādīt failu

@ -10,6 +10,11 @@
{%- include 'system.tex' %} {%- include 'system.tex' %}
{%- endwith %} {%- endwith %}
\section{Test Object Information}
{%- with object_information = data.testobject_information %}
{%- include 'object.tex' %}
{%- endwith %}
\section{Summary} \section{Summary}
{%- with testrun = data %} {%- with testrun = data %}

Failā izmaiņas netiks attēlotas, jo tās ir par lielu Ielādēt izmaiņas

Bināro failu nav iespējams attēlot.

Failā izmaiņas netiks attēlotas, jo tās ir par lielu Ielādēt izmaiņas

Bināro failu nav iespējams attēlot.

Failā izmaiņas netiks attēlotas, jo tās ir par lielu Ielādēt izmaiņas

Parādīt failu

@ -19,8 +19,11 @@ except ImportError:
class test_smarthome(object): class test_smarthome(object):
def __init__(self, rooms): def __init__(self, rooms, mqtt_client):
self.mqtt_client = mqtt_client
self.__init__tcl__() self.__init__tcl__()
self.mqtt_client.add_callback('__info__', self.__test_system_info__)
self.mqtt_client.send('__info__', json.dumps(None))
# add testcases for switching devices # add testcases for switching devices
for name in rooms.getmembers(): for name in rooms.getmembers():
obj = rooms.getobjbyname(name) obj = rooms.getobjbyname(name)
@ -84,7 +87,12 @@ class test_smarthome(object):
self.tcl[jsonlog.MAIN_KEY_SYSTEM_INFO] = system_info self.tcl[jsonlog.MAIN_KEY_SYSTEM_INFO] = system_info
self.tcl["testcase_names"] = report.TCEL_NAMES self.tcl["testcase_names"] = report.TCEL_NAMES
def __eval_tcl__(self): def __test_system_info__(self, client, userdata, message):
data = json.loads(message.payload)
if data is not None:
self.tcl[jsonlog.MAIN_KEY_TESTOBJECT_INFO] = data
def close(self):
path = os.path.abspath(os.path.join(os.path.basename(__file__), '..')) path = os.path.abspath(os.path.join(os.path.basename(__file__), '..'))
with open(os.path.join(path, "testresults", "testrun.json"), "w") as fh: with open(os.path.join(path, "testresults", "testrun.json"), "w") as fh:
@ -99,12 +107,6 @@ class test_smarthome(object):
with open(os.path.join(path, "testresults", "testrun_full.tex"), "w") as fh: with open(os.path.join(path, "testresults", "testrun_full.tex"), "w") as fh:
fh.write(template.render(data=self.tcl, details=True)) fh.write(template.render(data=self.tcl, details=True))
def __del__(self):
try:
self.__eval_tcl__()
except:
pass
def getmembers(self, prefix=''): def getmembers(self, prefix=''):
rv = [] rv = []
for name, obj in inspect.getmembers(self): for name, obj in inspect.getmembers(self):