From 2030a192de27e9d7c8fdc587e5d0ae250550c9d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E7=91=9E=E9=98=B3?= <2070216453@qq.com> Date: Mon, 29 May 2023 10:04:50 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E2=80=9C=E6=96=B0=E5=A2=9E=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E7=94=A8=E4=BE=8B=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- file/testcase/file-test.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/file/testcase/file-test.sh b/file/testcase/file-test.sh index 12cde52..61ebe6d 100755 --- a/file/testcase/file-test.sh +++ b/file/testcase/file-test.sh @@ -17,12 +17,16 @@ g_tmpdir="$(mktemp -d)" tc_setup() { msg "this is tc_setup" + #预置条件:系统正常运行,且已安装file软件包 assert_true yum install -y file return 0 } do_test() { msg "this is do_test" + + # @测试步骤:1:创建文件a.txt,并执行file -b a.txt + # @预期结果:1:成功获取到a.txt的file -b结果 assert_ture touch a.txt echo "test" >> a.txt assert_true file -b a.txt -- Gitee From 4ba49113ac55d81575dbcc68aed4467d06449f47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E7=91=9E=E9=98=B3?= <2070216453@qq.com> Date: Mon, 29 May 2023 11:08:02 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=A4=A9=E8=A1=97=E4=BA=86less=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- less/testcase/less-test.sh | 50 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100755 less/testcase/less-test.sh diff --git a/less/testcase/less-test.sh b/less/testcase/less-test.sh new file mode 100755 index 0000000..ccb317f --- /dev/null +++ b/less/testcase/less-test.sh @@ -0,0 +1,50 @@ +#!/bin/bash +############################################################################### +# @用例ID: 20220410-152859-724647329 +# @用例名称: test_shell_testcase +# @用例级别: 3 +# @用例标签: +# @用例类型: 功能 +############################################################################### +[ -z "$TST_TS_TOPDIR" ] && { + TST_TS_TOPDIR="$(realpath "$(dirname "$0")/..")" + export TST_TS_TOPDIR +} +source "${TST_TS_TOPDIR}/lib/common.sh" || exit 1 +############################################################################### + +g_tmpdir="$(mktemp -d)" + +tc_setup() { + msg "this is tc_setup" + # @预置条件:系统正常运行且已安装less软件包 + assert_true yum install -y less + return 0 +} + +do_test() { + msg "this is do_test" + + # @测试步骤:1: 创建文件a.txt并写入内容 + # @预期结果:1: 成功创建文件a.txt并写入内容 + assert_true touch a.txt + echo "test" >> a.txt + + + # @测试步骤:2:用less命令查看文件内容 + # @预期结果:2:成功显示文件内容 + assert_true less -e a.txt + + return 0 +} + +tc_teardown() { + msg "this is tc_teardown" + rm a.txt + rm -rfv "$g_tmpdir" || return 1 + return 0 +} + +############################################################################### +tst_main "$@" +############################################################################### -- Gitee From c290979da4ba73a131b586f38a0872ab635b7061 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E7=91=9E=E9=98=B3?= <2070216453@qq.com> Date: Mon, 29 May 2023 11:25:35 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E2=80=9C=E6=96=B0=E5=A2=9Eparted=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E7=94=A8=E4=BE=8B=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parted/testcase/parted-test.sh | 43 ++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100755 parted/testcase/parted-test.sh diff --git a/parted/testcase/parted-test.sh b/parted/testcase/parted-test.sh new file mode 100755 index 0000000..a9ce38c --- /dev/null +++ b/parted/testcase/parted-test.sh @@ -0,0 +1,43 @@ +#!/bin/bash +############################################################################### +# @用例ID: 20220410-152859-724647329 +# @用例名称: test_shell_testcase +# @用例级别: 3 +# @用例标签: +# @用例类型: 功能 +############################################################################### +[ -z "$TST_TS_TOPDIR" ] && { + TST_TS_TOPDIR="$(realpath "$(dirname "$0")/..")" + export TST_TS_TOPDIR +} +source "${TST_TS_TOPDIR}/lib/common.sh" || exit 1 +############################################################################### + +g_tmpdir="$(mktemp -d)" + +tc_setup() { + msg "this is tc_setup" + # @预置条件:系统正常运行且已安装parted软件包 + assert_true yum install -y parted + return 0 +} + +do_test() { + msg "this is do_test" + + # @测试步骤:1: 查看文件分区情况 + # @预期结果:1:成功显示文件分区情况 + + assert_true parted /dev.nvme0n1p2 print + return 0 +} + +tc_teardown() { + msg "this is tc_teardown" + rm -rfv "$g_tmpdir" || return 1 + return 0 +} + +############################################################################### +tst_main "$@" +############################################################################### -- Gitee