From 75aad7a3041d166c802f0c5d45537a981d1b05f1 Mon Sep 17 00:00:00 2001 From: zhaoyongjin1 Date: Fri, 20 Oct 2023 19:29:54 +0800 Subject: [PATCH 1/2] tdd bugfix Signed-off-by: zhaoyongjin1 --- tests/moduletests/BUILD.gn | 5 +---- tests/moduletests/backup_tool/tool_help_test.cpp | 1 - 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/tests/moduletests/BUILD.gn b/tests/moduletests/BUILD.gn index 5de2e6da9..2a137ec4c 100644 --- a/tests/moduletests/BUILD.gn +++ b/tests/moduletests/BUILD.gn @@ -17,8 +17,5 @@ import("//foundation/filemanagement/app_file_service/backup.gni") group("moduletests") { testonly = true - deps = [ - "backup_kit_inner:session_test", - "backup_tool:tools_test", - ] + deps = [ "backup_kit_inner:session_test" ] } diff --git a/tests/moduletests/backup_tool/tool_help_test.cpp b/tests/moduletests/backup_tool/tool_help_test.cpp index 26ad00ab1..fc57f03a1 100644 --- a/tests/moduletests/backup_tool/tool_help_test.cpp +++ b/tests/moduletests/backup_tool/tool_help_test.cpp @@ -50,7 +50,6 @@ HWTEST_F(ToolsTest, tool_help_0100, testing::ext::TestSize.Level0) } GTEST_LOG_(INFO) << "ToolsTest-end tool_help_0100"; } - /** * @tc.number: SUB_backup_tool_help_0200 * @tc.name: tool_help_0200 -- Gitee From b43b036c3535a798557e0fe6371002db2bb02dde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E6=B0=B8=E9=94=A6?= Date: Sat, 21 Oct 2023 09:54:57 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20test?= =?UTF-8?q?s/moduletests/backup=5Ftool/tool=5Fhelp=5Ftest.cpp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../backup_tool/tool_help_test.cpp | 77 ------------------- 1 file changed, 77 deletions(-) delete mode 100644 tests/moduletests/backup_tool/tool_help_test.cpp diff --git a/tests/moduletests/backup_tool/tool_help_test.cpp b/tests/moduletests/backup_tool/tool_help_test.cpp deleted file mode 100644 index fc57f03a1..000000000 --- a/tests/moduletests/backup_tool/tool_help_test.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2022-2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "b_process/b_process.h" -#include "test_manager.h" -#include "gtest/gtest.h" - -namespace OHOS::FileManagement::Backup { -class ToolsTest : public testing::Test { -public: - static void SetUpTestCase(void) {}; - static void TearDownTestCase() {}; - void SetUp() {}; - void TearDown() {}; -}; - -/** - * @tc.number: SUB_backup_tool_help_0100 - * @tc.name: tool_help_0100 - * @tc.desc: 测试help命令常规用法 - * @tc.size: MEDIUM - * @tc.type: FUNC - * @tc.level Level 0 - * @tc.require: I6F3GV - */ -HWTEST_F(ToolsTest, tool_help_0100, testing::ext::TestSize.Level0) -{ - GTEST_LOG_(INFO) << "ToolsTest-begin tool_help_0100"; - try { - auto [bFatalError, ret] = BProcess::ExecuteCmd({ - "/system/bin/backup_tool", - "help", - }); - EXPECT_EQ(ret, 0); - } catch (...) { - EXPECT_TRUE(false); - GTEST_LOG_(INFO) << "ToolsTest-an exception occurred."; - } - GTEST_LOG_(INFO) << "ToolsTest-end tool_help_0100"; -} -/** - * @tc.number: SUB_backup_tool_help_0200 - * @tc.name: tool_help_0200 - * @tc.desc: 测试help命令错误使用 - * @tc.size: MEDIUM - * @tc.type: FUNC - * @tc.level Level 0 - * @tc.require: I6F3GV - */ -HWTEST_F(ToolsTest, tool_help_0200, testing::ext::TestSize.Level0) -{ - GTEST_LOG_(INFO) << "ToolsTest-begin tool_help_0200"; - try { - auto [bFatalError, ret] = BProcess::ExecuteCmd({ - "/system/bin/backup_tool", - "xxxx", - }); - EXPECT_NE(ret, 0); - } catch (...) { - EXPECT_TRUE(false); - GTEST_LOG_(INFO) << "ToolsTest-an exception occurred."; - } - GTEST_LOG_(INFO) << "ToolsTest-end tool_help_0200"; -} -} // namespace OHOS::FileManagement::Backup \ No newline at end of file -- Gitee