diff options
author | 2023-03-08 13:48:03 +0800 | |
---|---|---|
committer | 2023-03-08 13:48:03 +0800 | |
commit | 0124d938848301f8768d715b20dc1c4af486dd33 (patch) | |
tree | 70e8e75bf09e15fcdb05084f5c249fd0768fdcf5 /plugins/agl_test_base.py | |
parent | 9648099248359cb00aa0c31d5436b537b0571853 (diff) |
agl-test-framework: solve bugs in the test framework
Fixed problems:
1.When all the executed test suites are skipped, no new summary-
report is generated.
2.When there is test suite successfully executed, the generated
summary-report will contain the test suites which have logs
in the "/tmp-log" directory, rather than just the test suites
which has just executed.
Correction method:
1.Move the function in "conftest.py" to "agl_test_report.py"
and call it in the "agl-test" script to ensure that the
function will be executed.
2.Set the timestamp to record the information of each executed
test suite or skipped test suite to the file of
"test_list_timestamp". And generate a summar-report according
to the above file.
Bug-AGL: SPEC-4345
Signed-off-by: duerpei <duep.fnst@fujitsu.com>
Change-Id: I47bfd09706e37ce6bdc13f3f9f266bc62f74f777
Diffstat (limited to 'plugins/agl_test_base.py')
-rw-r--r-- | plugins/agl_test_base.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/plugins/agl_test_base.py b/plugins/agl_test_base.py index 3a0bab4..b30f841 100644 --- a/plugins/agl_test_base.py +++ b/plugins/agl_test_base.py @@ -1,4 +1,6 @@ import pytest +import os +import json import plugins.agl_test_utils as utils import plugins.agl_test_conf as conf @@ -111,3 +113,23 @@ class AGLBaseTest: def precheck(self): return True; + + def write_skip_info(self): + test_info = {"status":"skip","path":""} + self.write_info_to_file(test_info) + + def write_run_info(self): + path_str = self.name + "/report.json" + test_info = {"status":"run","path":path_str} + self.write_info_to_file(test_info) + + def write_info_to_file(self, test_info): + time_stamp = os.getenv("TIME_STAMP") + test_list = "/var/run/agl-test/logs/tmp-log/test_list_" + time_stamp + ".json" + with open(test_list, 'r') as f: + test_suites = json.load(f) + f.close() + with open(test_list, 'w') as f: + test_suites[self.name] = test_info + json.dump(test_suites,f) + f.close() |