aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorduerpei <duep.fnst@fujitsu.com>2022-06-11 18:20:50 +0800
committerduerpei <duep.fnst@fujitsu.com>2022-06-11 18:20:50 +0800
commit18633e747c6bb469f31d2bc2e595b85099865b4f (patch)
tree0a3c11e2256416faedaee2c94604ce120fd03bd2 /plugins
parentcb256cee0fe43430b461dcee392267dc65514e41 (diff)
agl-test-framework: add PTESTBaseTest class
Add PTESTBaseTest class for test sets called from ptest. It inherits from AGLBaseTest class. It contains two common functions used to run the ptest test set. In test suite, please create a child class based on PTESTBaseTest. Then it is easy to init, run tests, check results and make a repoter. By the way, delete the useless code in agl_test_report.py Bug-AGL: SPEC-4345 Signed-off-by: duerpei <duep.fnst@fujitsu.com> Change-Id: Ief99073e4f63a44bde387b8c42d029c47fbf0943
Diffstat (limited to 'plugins')
-rw-r--r--plugins/agl_test_ptest_base.py30
-rw-r--r--plugins/agl_test_report.py2
2 files changed, 30 insertions, 2 deletions
diff --git a/plugins/agl_test_ptest_base.py b/plugins/agl_test_ptest_base.py
new file mode 100644
index 0000000..f7b5829
--- /dev/null
+++ b/plugins/agl_test_ptest_base.py
@@ -0,0 +1,30 @@
+import subprocess
+
+from plugins.agl_test_base import AGLBaseTest
+
+class PTESTBase(AGLBaseTest):
+
+ def __init__(self, test_name: str):
+ super().__init__(name=test_name)
+
+ #Run test by ptest-runner
+ def run_test_fun(self):
+ log_file = self.get_logfile()
+ with open(log_file,'w') as log_f:
+ subprocess.run(['ptest-runner', super().get_name()],
+ stdout=log_f, stderr=log_f)
+ log_f.close()
+
+ def run_case(self, case_id):
+ case_info = self.get_caseinfo_by_name(case_id)
+ if (case_info[1] == "PASS"):
+ case_info[2] = "passed"
+ elif (case_info[1] == "FAIL"):
+ case_info[2] = "failed"
+ elif (case_info[1] == "SKIP"):
+ case_info[2] = "skipped"
+ else:
+ case_info[2] = "failed"
+
+ self.update_caseinfo_by_name(case_id, case_info)
+ assert case_info[2] == "passed" or case_info[2] == "skipped"
diff --git a/plugins/agl_test_report.py b/plugins/agl_test_report.py
index 8c7a514..f9d9fc3 100644
--- a/plugins/agl_test_report.py
+++ b/plugins/agl_test_report.py
@@ -177,7 +177,6 @@ def create_gen_web_page(filename, tlpname, html_data):
f.close()
def write_data_to_file(data, file_type = "json"):
- print(data)
testname = data["test_name"]
if (file_type == "json"):
filename = conf.get_json_filename(testname)
@@ -229,6 +228,5 @@ def format_case_status_table(case_status):
html_data += "\t\t<th>" + key + "</th>\n"
html_data += "\t\t<th>" + case_status[key] + "</th>\n"
html_data += "\t</tr>\n"
- print(html_data)
return html_data