From 6eba737d5d262543b3b15c9145b2a54f4e6c4ce9 Mon Sep 17 00:00:00 2001 From: Teacher_Dong Date: Fri, 17 Nov 2023 16:11:18 +0800 Subject: [PATCH] Signed-off-by:Teacher_Dong --- .../ets/MainAbility/pages/index/index.ets | 4 +- .../ets/test/GetProfileByAbility.test.ets | 11 ++-- .../entry/src/main/ets/test/Utils.ets | 6 +-- localCoverage/all_subsystem_config.json | 54 +++++++++++++++++++ localCoverage/coverage_tools.py | 2 +- .../restore_comment/build_before_generate.py | 2 +- src/core/driver/drivers.py | 10 ++-- 7 files changed, 73 insertions(+), 16 deletions(-) diff --git a/examples/stagetest/actsbundlemanagerstagetest/entry/src/main/ets/MainAbility/pages/index/index.ets b/examples/stagetest/actsbundlemanagerstagetest/entry/src/main/ets/MainAbility/pages/index/index.ets index f172d89..10b3829 100644 --- a/examples/stagetest/actsbundlemanagerstagetest/entry/src/main/ets/MainAbility/pages/index/index.ets +++ b/examples/stagetest/actsbundlemanagerstagetest/entry/src/main/ets/MainAbility/pages/index/index.ets @@ -25,9 +25,9 @@ struct Index { aboutToAppear(){ console.info("start run testcase!!!!") - var abilityDelegator: any + let abilityDelegator: any abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var abilityDelegatorArguments: any + let abilityDelegatorArguments: any abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() console.info('start run testcase!!!') Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) diff --git a/examples/stagetest/actsbundlemanagerstagetest/entry/src/main/ets/test/GetProfileByAbility.test.ets b/examples/stagetest/actsbundlemanagerstagetest/entry/src/main/ets/test/GetProfileByAbility.test.ets index 6b3db1c..0b31fc2 100644 --- a/examples/stagetest/actsbundlemanagerstagetest/entry/src/main/ets/test/GetProfileByAbility.test.ets +++ b/examples/stagetest/actsbundlemanagerstagetest/entry/src/main/ets/test/GetProfileByAbility.test.ets @@ -15,6 +15,7 @@ import manager from '@ohos.bundle.bundleManager'; import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium" +import { BusinessError } from '@ohos.base'; const MODULE_NAME = "testModule" const MODULE_NAME_TEST = "testModule1" @@ -33,19 +34,19 @@ const ERROR_PROFILE_NOT_EXIST = 17700024 const ERROR_MODULE_NOT_EXIST = 17700002 export default function getProfileByAbility() { - describe('getProfileByAbility', function () { + describe('getProfileByAbility', () => { /* * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0011 * @tc.name: getProfileByAbilityInvalidModulePro * @tc.desc: Check the invalid moduleName (by promise) * @tc.level 0 */ - it('getProfileByAbilityInvalidModulePro', 0, async function (done) { + it('getProfileByAbilityInvalidModulePro', 0, async (done: Function) => { await manager.getProfileByAbility(MODULE_NAME_TEST, ABILITY_NAME, METADATA_NAME).then(data => { console.info('getProfileByAbilityInvalidModulePro success' + JSON.stringify(data)) expect(data).assertFail() done() - }).catch(err => { + }).catch((err: BusinessError) => { console.info('getProfileByAbilityInvalidModulePro failed' + JSON.stringify(err)) expect(err.code).assertEqual(ERROR_ABILITY_NOT_EXIST) done() @@ -58,12 +59,12 @@ export default function getProfileByAbility() { * @tc.desc: Check the empty moduleName (by promise) * @tc.level 0 */ - it('getProfileByAbilityEmptyModulePro', 0, async function (done) { + it('getProfileByAbilityEmptyModulePro', 0, async (done: Function) => { await manager.getProfileByAbility('', ABILITY_NAME, METADATA_NAME).then(data => { console.info('getProfileByAbilityEmptyModulePro success' + JSON.stringify(data)) expect(data).assertFail() done() - }).catch(err => { + }).catch((err: BusinessError) => { console.info('getProfileByAbilityEmptyModulePro failed' + JSON.stringify(err)) expect(err.code).assertEqual(ERROR_MODULE_NOT_EXIST) done() diff --git a/examples/stagetest/actsbundlemanagerstagetest/entry/src/main/ets/test/Utils.ets b/examples/stagetest/actsbundlemanagerstagetest/entry/src/main/ets/test/Utils.ets index f3b5fe7..65b821c 100644 --- a/examples/stagetest/actsbundlemanagerstagetest/entry/src/main/ets/test/Utils.ets +++ b/examples/stagetest/actsbundlemanagerstagetest/entry/src/main/ets/test/Utils.ets @@ -14,9 +14,9 @@ */ export default class Utils { - static sleep(time) { - return new Promise((resolve, reject) => { - setTimeout((data) => { + static sleep(time: number) { + return new Promise((resolve, reject) => { + setTimeout((data: Object[]) => { resolve(data) }, time) }).then(() => { diff --git a/localCoverage/all_subsystem_config.json b/localCoverage/all_subsystem_config.json index c12dea7..2734c42 100644 --- a/localCoverage/all_subsystem_config.json +++ b/localCoverage/all_subsystem_config.json @@ -1900,5 +1900,59 @@ "path": [ "commonlibrary/rust/ylong_runtime" ] + }, + "findnetwork": { + "name": "findnetwork", + "path": [ + "vendor/huawei/domains/finddevice/findnetwork" + ] + }, + "push_manager_service": { + "name": "push_manager_service", + "path": [ + "vendor/huawei/domains/push/push_manager_service" + ] + }, + "quickfix_engine": { + "name": "quickfix_engine", + "path": [ + "vendor/huawei/base/update/quickfix_engine" + ] + }, + "security_guard": { + "name": "security_guard", + "path": [ + "base/security/security_guard" + ] + }, + "container_hmos_service_broker": { + "name": "container_hmos_service_broker", + "path": [ + "vendor/huawei/virt_service/container_hmos_service_broker" + ] + }, + "iShare": { + "name": "iShare", + "path": [ + "vendor/huawei/foundation/HMconnect/iShare" + ] + }, + "cast_engine": { + "name": "cast_engine", + "path": [ + "vendor/huawei/foundation/HMconnect/CastEngine" + ] + }, + "CollaborationFwk": { + "name": "CollaborationFwk", + "path": [ + "vendor/huawei/foundation/HMconnect/CollaborationFwk" + ] + }, + "sys_installer_ext": { + "name": "sys_installer_ext", + "path": [ + "vendor/huawei/base/update/sys_installer_ext" + ] } } diff --git a/localCoverage/coverage_tools.py b/localCoverage/coverage_tools.py index 1aee796..7f235c5 100644 --- a/localCoverage/coverage_tools.py +++ b/localCoverage/coverage_tools.py @@ -42,7 +42,7 @@ def get_subsystem_config(part_list, developer_path): if part in system_text_json: new_json_text[part] = system_text_json[part] else: - print("part not in all_subsystem_config.json") + print("Error: part not in all_subsystem_config.json") new_json = json.dumps(new_json_text, indent=4) with open(system_info_path, "w") as out_file: diff --git a/localCoverage/restore_comment/build_before_generate.py b/localCoverage/restore_comment/build_before_generate.py index 4f79506..d5dbfeb 100644 --- a/localCoverage/restore_comment/build_before_generate.py +++ b/localCoverage/restore_comment/build_before_generate.py @@ -127,7 +127,7 @@ def get_part_config_json(part_list, system_info_path, part_path): if part in system_text_json: new_json_text[part] = system_text_json[part] else: - print("part not in all_subsystem_config.json") + print("Error: part not in all_subsystem_config.json") new_json = json.dumps(new_json_text, indent=4) with open(part_path, "w") as out_file: out_file.write(new_json) diff --git a/src/core/driver/drivers.py b/src/core/driver/drivers.py index f32ced5..9dc1045 100644 --- a/src/core/driver/drivers.py +++ b/src/core/driver/drivers.py @@ -101,7 +101,8 @@ class DisplayOutputReceiver: lines = self._process_output(output) for line in lines: line = line.strip() - if line: + if "[ RUN ]" in line or "[ OK ]" in line or "[==========]" in line or \ + "[----------]" in line or "[ PASSED ]" in line or "[ FAILED ]" in line: LOG.info(get_decode(line)) def __error__(self, message): @@ -164,8 +165,9 @@ def get_result_savepath(testsuit_path, result_rootpath): return result_path -def get_test_log_savepath(result_rootpath): - test_log_path = os.path.join(result_rootpath, "log", "test_log") +def get_test_log_savepath(result_rootpath, result_suit_path): + suit_path = result_suit_path.split("result")[-1].strip(os.sep).split(os.sep)[0] + test_log_path = os.path.join(result_rootpath, "log", "test_log", suit_path) if not os.path.exists(test_log_path): os.makedirs(test_log_path) @@ -436,7 +438,7 @@ class ResultManager(object): if self.config.hidelog: remote_log_result_file = os.path.join(self.device_testpath, "%s.log" % self.testsuite_name) - test_log_save_path = get_test_log_savepath(self.result_rootpath) + test_log_save_path = get_test_log_savepath(self.result_rootpath, result_save_path) test_log_file_path = os.path.join(test_log_save_path, "%s.log" % self.testsuite_name) self.device.pull_file(remote_log_result_file, test_log_file_path) -- Gitee