Test object information added to report

This commit is contained in:
Dirk Alders 2023-02-09 16:01:04 +01:00
父節點 bd1966ed4f
當前提交 0d7b9c3903
共有 9 個文件被更改,包括 129186 次插入1721 次删除

查看文件

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

11
templates/object.tex Normal file
查看文件

@ -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}

查看文件

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

文件差異過大導致無法顯示 Load Diff

Binary file not shown.

文件差異過大導致無法顯示 Load Diff

Binary file not shown.

文件差異過大導致無法顯示 Load Diff

查看文件

@ -19,8 +19,11 @@ except ImportError:
class test_smarthome(object):
def __init__(self, rooms):
def __init__(self, rooms, mqtt_client):
self.mqtt_client = mqtt_client
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
for name in rooms.getmembers():
obj = rooms.getobjbyname(name)
@ -84,7 +87,12 @@ class test_smarthome(object):
self.tcl[jsonlog.MAIN_KEY_SYSTEM_INFO] = system_info
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__), '..'))
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:
fh.write(template.render(data=self.tcl, details=True))
def __del__(self):
try:
self.__eval_tcl__()
except:
pass
def getmembers(self, prefix=''):
rv = []
for name, obj in inspect.getmembers(self):