From c36f7ca9b8145828c7dd8545b3b2d0d9ac7c217e Mon Sep 17 00:00:00 2001 From: zhaoke Date: Sat, 10 Jun 2023 13:37:18 +0800 Subject: [PATCH] fix unit test issue. --- cmd/test/cli/cli_cb_test.go | 2 +- cmd/test/cli/cli_ci_test.go | 2 +- cmd/test/cli/cli_clean_test.go | 5 +++-- cmd/test/cli/cli_co_test.go | 2 +- cmd/test/cli/cli_cr_test.go | 4 +--- cmd/test/cli/cli_expect_test.go | 2 +- cmd/test/cli/cli_extract_test.go | 2 +- cmd/test/cli/cli_help_test.go | 2 +- cmd/test/cli/cli_list_test.go | 2 +- cmd/test/cli/cli_run_test.go | 2 +- cmd/test/cli/cli_run_unit_test.go | 3 ++- cmd/test/cli/cli_set_test.go | 4 ++-- cmd/test/cli/cli_version_test.go | 2 +- cmd/test/cli/cli_view_test.go | 2 +- cmd/test/helper/common/allure.go | 11 ++++++++++ cmd/test/restapi/api_bug_test.go | 6 ++++-- cmd/test/restapi/api_case_test.go | 3 ++- cmd/test/restapi/api_module_test.go | 6 ++++-- cmd/test/restapi/api_product_test.go | 6 ++++-- cmd/test/restapi/api_result_test.go | 8 ++++--- cmd/test/restapi/api_suite_test.go | 6 ++++-- cmd/test/restapi/api_task_test.go | 6 ++++-- cmd/test/restapi/api_token_test.go | 6 ++++-- cmd/test/ui/ui_bug_test.go | 5 +++-- cmd/test/ui/ui_interpreter_test.go | 7 ++++--- cmd/test/ui/ui_language_test.go | 3 ++- cmd/test/ui/ui_log_test.go | 9 ++++---- cmd/test/ui/ui_product_test.go | 3 ++- cmd/test/ui/ui_proxy_test.go | 7 ++++--- cmd/test/ui/ui_result_test.go | 15 ++++++------- cmd/test/ui/ui_run_from_result_test.go | 5 +++-- cmd/test/ui/ui_run_statistic_test.go | 7 ++++--- cmd/test/ui/ui_run_test.go | 20 +++++++++--------- cmd/test/ui/ui_run_unit_test.go | 2 +- cmd/test/ui/ui_script_test.go | 13 ++++++------ cmd/test/ui/ui_server_test.go | 7 ++++--- cmd/test/ui/ui_site_test.go | 15 ++++++------- cmd/test/ui/ui_workspace_filter_test.go | 9 ++++---- cmd/test/ui/ui_workspace_test.go | 28 ++++++++++++------------- go.mod | 1 + internal/pkg/helper/exec/report-unit.go | 5 +++-- internal/pkg/helper/exec/result.go | 4 ++-- 42 files changed, 150 insertions(+), 109 deletions(-) create mode 100644 cmd/test/helper/common/allure.go diff --git a/cmd/test/cli/cli_cb_test.go b/cmd/test/cli/cli_cb_test.go index 635e1399..7ebcc76b 100644 --- a/cmd/test/cli/cli_cb_test.go +++ b/cmd/test/cli/cli_cb_test.go @@ -25,7 +25,7 @@ type CbSuite struct { func (s *CbSuite) BeforeEach(t provider.T) { t.ID("1591") - t.AddSubSuite("命令行-提交失败结果为禅道中缺陷") + commonTestHelper.ReplaceLabel(t, "命令行-提交失败结果为禅道中缺陷") } func (s *CbSuite) TestCbSuite(t provider.T) { t.Require().Equal("Success", testCb()) diff --git a/cmd/test/cli/cli_ci_test.go b/cmd/test/cli/cli_ci_test.go index b5fb2d58..c16ea975 100644 --- a/cmd/test/cli/cli_ci_test.go +++ b/cmd/test/cli/cli_ci_test.go @@ -33,7 +33,7 @@ type CiSuite struct { func (s *CiSuite) BeforeEach(t provider.T) { t.ID("5431") - t.AddSubSuite("命令行-同步用例信息到禅道") + commonTestHelper.ReplaceLabel(t, "命令行-同步用例信息到禅道") } func (s *CiSuite) TestCiSuite(t provider.T) { t.Require().Equal("Success", testCi()) diff --git a/cmd/test/cli/cli_clean_test.go b/cmd/test/cli/cli_clean_test.go index 443272ab..05abc183 100644 --- a/cmd/test/cli/cli_clean_test.go +++ b/cmd/test/cli/cli_clean_test.go @@ -2,13 +2,14 @@ package main import ( "fmt" - commonTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/common" "os" "regexp" "runtime" "testing" "time" + commonTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/common" + expect "github.com/easysoft/zentaoatf/pkg/lib/expect" "github.com/ozontech/allure-go/pkg/framework/provider" "github.com/ozontech/allure-go/pkg/framework/suite" @@ -24,7 +25,7 @@ type CleanSuite struct { func (s *CleanSuite) BeforeEach(t provider.T) { t.ID("1595") - t.AddSubSuite("命令行-清除测试日志") + commonTestHelper.ReplaceLabel(t, "命令行-清除测试日志") } func (s *CleanSuite) TestCleanSuite(t provider.T) { t.Require().Equal("Success", testClean()) diff --git a/cmd/test/cli/cli_co_test.go b/cmd/test/cli/cli_co_test.go index 6aa632e9..0ac907bc 100644 --- a/cmd/test/cli/cli_co_test.go +++ b/cmd/test/cli/cli_co_test.go @@ -56,7 +56,7 @@ type CoSuite struct { func (s *CoSuite) BeforeEach(t provider.T) { t.ID("1580") - t.AddSubSuite("命令行-co") + commonTestHelper.ReplaceLabel(t, "命令行-从禅道同步用例") if runtime.GOOS == "windows" { productDir = ".\\product1" diff --git a/cmd/test/cli/cli_cr_test.go b/cmd/test/cli/cli_cr_test.go index 550c371f..21077cd6 100644 --- a/cmd/test/cli/cli_cr_test.go +++ b/cmd/test/cli/cli_cr_test.go @@ -28,12 +28,11 @@ type CrSuite struct { func (s *CrSuite) BeforeEach(t provider.T) { t.ID("1590") - t.AddSubSuite("命令行-提交测试结果到禅道") + commonTestHelper.ReplaceLabel(t, "命令行-提交测试结果到禅道") } func (s *CrSuite) TestAutoCr(t provider.T) { t.ID("7558") - t.AddSubSuite("命令行-提交测试结果到禅道免确认") caseInfo := apiTest.GetCaseResult(1) lastId := caseInfo["Id"].(int64) @@ -60,7 +59,6 @@ func (s *CrSuite) TestAutoCr(t provider.T) { func (s *CrSuite) TestCr(t provider.T) { t.ID("1590") - t.AddSubSuite("命令行-提交测试结果到禅道") caseInfo := apiTest.GetCaseResult(1) lastId := caseInfo["Id"].(int64) diff --git a/cmd/test/cli/cli_expect_test.go b/cmd/test/cli/cli_expect_test.go index 6be7525e..f3e4dc5c 100644 --- a/cmd/test/cli/cli_expect_test.go +++ b/cmd/test/cli/cli_expect_test.go @@ -26,7 +26,7 @@ type ExpectSuite struct { func (s *ExpectSuite) BeforeEach(t provider.T) { t.ID("5429") - t.AddSubSuite("命令行-生成独立的期待结果文件") + commonTestHelper.ReplaceLabel(t, "命令行-生成独立的期待结果文件") } func (s *ExpectSuite) TestExpectSuite(t provider.T) { t.Require().Equal("Success", testExpect()) diff --git a/cmd/test/cli/cli_extract_test.go b/cmd/test/cli/cli_extract_test.go index 2f3c0872..35d5eb30 100644 --- a/cmd/test/cli/cli_extract_test.go +++ b/cmd/test/cli/cli_extract_test.go @@ -26,7 +26,7 @@ type ExtractSuite struct { func (s *ExtractSuite) BeforeEach(t provider.T) { t.ID("5430") - t.AddSubSuite("命令行-提取分散在脚本中的注释") + commonTestHelper.ReplaceLabel(t, "命令行-提取分散在脚本中的注释") } func (s *ExtractSuite) TestExtractSuite(t provider.T) { t.Require().Equal("Success", testExtract()) diff --git a/cmd/test/cli/cli_help_test.go b/cmd/test/cli/cli_help_test.go index 30632f19..29193ffb 100644 --- a/cmd/test/cli/cli_help_test.go +++ b/cmd/test/cli/cli_help_test.go @@ -22,7 +22,7 @@ type HelpSuite struct { func (s *HelpSuite) BeforeEach(t provider.T) { t.ID("1578") - t.AddSubSuite("命令行-查看帮助") + commonTestHelper.ReplaceLabel(t, "命令行-查看帮助") } func (s *HelpSuite) TestHelpSuite(t provider.T) { t.Require().Equal("Success", testHelp()) diff --git a/cmd/test/cli/cli_list_test.go b/cmd/test/cli/cli_list_test.go index c577d411..3def9a2f 100644 --- a/cmd/test/cli/cli_list_test.go +++ b/cmd/test/cli/cli_list_test.go @@ -19,7 +19,7 @@ type ListSuite struct { func (s *ListSuite) BeforeEach(t provider.T) { t.ID("1592") - t.AddSubSuite("命令行-查看脚本列表") + commonTestHelper.ReplaceLabel(t, "命令行-查看脚本列表") } func (s *ListSuite) TestListSuite(t provider.T) { t.Require().Equal("Success", testLs(commonTestHelper.GetZtfPath()+fmt.Sprintf(" list %scmd/test/demo", constTestHelper.RootPath), regexp.MustCompile("Found 7 test cases|发现7个用例"))) diff --git a/cmd/test/cli/cli_run_test.go b/cmd/test/cli/cli_run_test.go index 418c1bbd..657f68ef 100644 --- a/cmd/test/cli/cli_run_test.go +++ b/cmd/test/cli/cli_run_test.go @@ -41,7 +41,7 @@ func (s *RunSuite) BeforeEach(t provider.T) { } else { os.RemoveAll(fmt.Sprintf("%s/cmd/test/demo/php/product1", constTestHelper.RootPath)) } - t.AddSubSuite("命令行-run") + commonTestHelper.ReplaceLabel(t, "命令行-运行脚本") } func (s *RunSuite) TestRunZtfFile(t provider.T) { diff --git a/cmd/test/cli/cli_run_unit_test.go b/cmd/test/cli/cli_run_unit_test.go index d38ff75a..1ae72c62 100644 --- a/cmd/test/cli/cli_run_unit_test.go +++ b/cmd/test/cli/cli_run_unit_test.go @@ -14,6 +14,7 @@ import ( "strings" "testing" + commonTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/common" constTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/conf" fileUtils "github.com/easysoft/zentaoatf/pkg/lib/file" "github.com/go-git/go-git/v5" @@ -31,7 +32,7 @@ func (s *RunUnitSuit) BeforeEach(t provider.T) { } else { os.RemoveAll(fmt.Sprintf("%s/cmd/test/demo/php/product1", constTestHelper.RootPath)) } - t.AddSubSuite("命令行-run") + commonTestHelper.ReplaceLabel(t, "命令行-运行单元测试") } func (s *RunUnitSuit) TestRunTestng(t provider.T) { diff --git a/cmd/test/cli/cli_set_test.go b/cmd/test/cli/cli_set_test.go index 6993e05c..31791e52 100644 --- a/cmd/test/cli/cli_set_test.go +++ b/cmd/test/cli/cli_set_test.go @@ -46,7 +46,7 @@ type SetSuite struct { func (s *SetSuite) BeforeEach(t provider.T) { t.ID("1579") - t.AddSubSuite("命令行-set") + commonTestHelper.ReplaceLabel(t, "命令行-设置") } func (s *SetSuite) TestChSetSuite(t provider.T) { @@ -110,7 +110,7 @@ func testSet(language string) (ret string) { for _, lang := range langArray { out, err := child.Expect(regexp.MustCompile("Please set script|请设置"), time.Second*5) if err != nil { - return fmt.Sprintf("expect %s, actual %s", lang, err.Error()) + return fmt.Sprintf("expect Please set script|请设置%s, actual %s", lang, err.Error()) } sendMsg := "" diff --git a/cmd/test/cli/cli_version_test.go b/cmd/test/cli/cli_version_test.go index df5e4a42..9c48f5a6 100644 --- a/cmd/test/cli/cli_version_test.go +++ b/cmd/test/cli/cli_version_test.go @@ -22,7 +22,7 @@ type VersionSuite struct { func (s *VersionSuite) BeforeEach(t provider.T) { t.ID("7534") - t.AddSubSuite("命令行-查看ZTF版本") + commonTestHelper.ReplaceLabel(t, "命令行-查看ZTF版本") } func (s *VersionSuite) TestVersionSuite(t provider.T) { t.Require().Equal("Success", testVersion()) diff --git a/cmd/test/cli/cli_view_test.go b/cmd/test/cli/cli_view_test.go index 1576c218..2cab09a5 100644 --- a/cmd/test/cli/cli_view_test.go +++ b/cmd/test/cli/cli_view_test.go @@ -19,7 +19,7 @@ type ViewSuite struct { func (s *ViewSuite) BeforeEach(t provider.T) { t.ID("1593") - t.AddSubSuite("命令行-查看脚本详情") + commonTestHelper.ReplaceLabel(t, "命令行-查看脚本详情") } func (s *ViewSuite) TestViewSuite(t provider.T) { t.Require().Equal("Success", testView(commonTestHelper.GetZtfPath()+fmt.Sprintf(" view %scmd/test/demo/1_string_match_fail.php", constTestHelper.RootPath), regexp.MustCompile("check string matches pattern"))) diff --git a/cmd/test/helper/common/allure.go b/cmd/test/helper/common/allure.go new file mode 100644 index 00000000..e796aea0 --- /dev/null +++ b/cmd/test/helper/common/allure.go @@ -0,0 +1,11 @@ +package commonTestHelper + +import ( + "github.com/ozontech/allure-go/pkg/allure" + "github.com/ozontech/allure-go/pkg/framework/provider" +) + +func ReplaceLabel(t provider.T, value string) { + label := allure.Label{Name: "suite", Value: value} + t.ReplaceLabel(&label) +} diff --git a/cmd/test/restapi/api_bug_test.go b/cmd/test/restapi/api_bug_test.go index 871d5926..632ada47 100644 --- a/cmd/test/restapi/api_bug_test.go +++ b/cmd/test/restapi/api_bug_test.go @@ -2,6 +2,9 @@ package main import ( "fmt" + "testing" + + commonTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/common" constTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/conf" httpHelper "github.com/easysoft/zentaoatf/cmd/test/helper/http" "github.com/easysoft/zentaoatf/cmd/test/restapi/config" @@ -10,7 +13,6 @@ import ( "github.com/ozontech/allure-go/pkg/framework/provider" "github.com/ozontech/allure-go/pkg/framework/suite" "github.com/tidwall/gjson" - "testing" ) const ( @@ -28,7 +30,7 @@ type BugApiSuite struct { func (s *BugApiSuite) BeforeEach(t provider.T) { t.ID("0") - t.AddSubSuite("BugApi") + commonTestHelper.ReplaceLabel(t, "BugApi") } func (s *BugApiSuite) TestBugListApi(t provider.T) { diff --git a/cmd/test/restapi/api_case_test.go b/cmd/test/restapi/api_case_test.go index 5b031518..c5829b8f 100644 --- a/cmd/test/restapi/api_case_test.go +++ b/cmd/test/restapi/api_case_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + commonTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/common" constTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/conf" httpHelper "github.com/easysoft/zentaoatf/cmd/test/helper/http" "github.com/easysoft/zentaoatf/cmd/test/restapi/config" @@ -25,7 +26,7 @@ type CaseApiSuite struct { } func (s *CaseApiSuite) BeforeEach(t provider.T) { - t.AddSubSuite("CaseApi") + commonTestHelper.ReplaceLabel(t, "CaseApi") } func (s *CaseApiSuite) TestCaseListApi(t provider.T) { diff --git a/cmd/test/restapi/api_module_test.go b/cmd/test/restapi/api_module_test.go index 1acb99e7..e38cbf7f 100644 --- a/cmd/test/restapi/api_module_test.go +++ b/cmd/test/restapi/api_module_test.go @@ -2,6 +2,9 @@ package main import ( "fmt" + "testing" + + commonTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/common" constTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/conf" httpHelper "github.com/easysoft/zentaoatf/cmd/test/helper/http" "github.com/easysoft/zentaoatf/cmd/test/restapi/config" @@ -9,7 +12,6 @@ import ( "github.com/ozontech/allure-go/pkg/framework/provider" "github.com/ozontech/allure-go/pkg/framework/suite" "github.com/tidwall/gjson" - "testing" ) func TestModuleApi(t *testing.T) { @@ -21,7 +23,7 @@ type ModuleApiSuite struct { } func (s *ModuleApiSuite) BeforeEach(t provider.T) { - t.AddSubSuite("ModuleApi") + commonTestHelper.ReplaceLabel(t, "ModuleApi") } func (s *ModuleApiSuite) TestModuleListForCaseApi(t provider.T) { diff --git a/cmd/test/restapi/api_product_test.go b/cmd/test/restapi/api_product_test.go index bc296552..c0e6786d 100644 --- a/cmd/test/restapi/api_product_test.go +++ b/cmd/test/restapi/api_product_test.go @@ -2,6 +2,9 @@ package main import ( "fmt" + "testing" + + commonTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/common" constTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/conf" httpHelper "github.com/easysoft/zentaoatf/cmd/test/helper/http" "github.com/easysoft/zentaoatf/cmd/test/restapi/config" @@ -9,7 +12,6 @@ import ( "github.com/ozontech/allure-go/pkg/framework/provider" "github.com/ozontech/allure-go/pkg/framework/suite" "github.com/tidwall/gjson" - "testing" ) func TestProductApi(t *testing.T) { @@ -21,7 +23,7 @@ type ProductApiSuite struct { } func (s *ProductApiSuite) BeforeEach(t provider.T) { - t.AddSubSuite("ProductApi") + commonTestHelper.ReplaceLabel(t, "ProductApi") } func (s *ProductApiSuite) TestProductListApi(t provider.T) { diff --git a/cmd/test/restapi/api_result_test.go b/cmd/test/restapi/api_result_test.go index 1e264c89..dc4d930b 100644 --- a/cmd/test/restapi/api_result_test.go +++ b/cmd/test/restapi/api_result_test.go @@ -3,6 +3,10 @@ package main import ( "encoding/json" "fmt" + "log" + "testing" + + commonTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/common" constTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/conf" httpHelper "github.com/easysoft/zentaoatf/cmd/test/helper/http" "github.com/easysoft/zentaoatf/cmd/test/restapi/config" @@ -12,8 +16,6 @@ import ( "github.com/ozontech/allure-go/pkg/framework/provider" "github.com/ozontech/allure-go/pkg/framework/suite" "github.com/tidwall/gjson" - "log" - "testing" ) func TestResultApi(t *testing.T) { @@ -25,7 +27,7 @@ type ResultApiSuite struct { } func (s *ResultApiSuite) BeforeEach(t provider.T) { - t.AddSubSuite("SuiteApi") + commonTestHelper.ReplaceLabel(t, "SuiteApi") } func (s *ResultApiSuite) TestResultSubmitZtfResultApi(t provider.T) { diff --git a/cmd/test/restapi/api_suite_test.go b/cmd/test/restapi/api_suite_test.go index c49f8888..b7a010ea 100644 --- a/cmd/test/restapi/api_suite_test.go +++ b/cmd/test/restapi/api_suite_test.go @@ -2,6 +2,9 @@ package main import ( "fmt" + "testing" + + commonTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/common" constTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/conf" httpHelper "github.com/easysoft/zentaoatf/cmd/test/helper/http" "github.com/easysoft/zentaoatf/cmd/test/restapi/config" @@ -9,7 +12,6 @@ import ( "github.com/ozontech/allure-go/pkg/framework/provider" "github.com/ozontech/allure-go/pkg/framework/suite" "github.com/tidwall/gjson" - "testing" ) func TestSuiteApi(t *testing.T) { @@ -21,7 +23,7 @@ type SuiteApiSuite struct { } func (s *SuiteApiSuite) BeforeEach(t provider.T) { - t.AddSubSuite("SuiteApi") + commonTestHelper.ReplaceLabel(t, "SuiteApi") } func (s *SuiteApiSuite) TestSuiteListApi(t provider.T) { diff --git a/cmd/test/restapi/api_task_test.go b/cmd/test/restapi/api_task_test.go index 8b2e364a..2df456e5 100644 --- a/cmd/test/restapi/api_task_test.go +++ b/cmd/test/restapi/api_task_test.go @@ -2,6 +2,9 @@ package main import ( "fmt" + "testing" + + commonTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/common" constTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/conf" httpHelper "github.com/easysoft/zentaoatf/cmd/test/helper/http" "github.com/easysoft/zentaoatf/cmd/test/restapi/config" @@ -9,7 +12,6 @@ import ( "github.com/ozontech/allure-go/pkg/framework/provider" "github.com/ozontech/allure-go/pkg/framework/suite" "github.com/tidwall/gjson" - "testing" ) func TestTaskApi(t *testing.T) { @@ -21,7 +23,7 @@ type TaskApiSuite struct { } func (s *TaskApiSuite) BeforeEach(t provider.T) { - t.AddSubSuite("TaskApi") + commonTestHelper.ReplaceLabel(t, "TaskApi") } func (s *TaskApiSuite) TestTaskListApi(t provider.T) { diff --git a/cmd/test/restapi/api_token_test.go b/cmd/test/restapi/api_token_test.go index 5e6ad102..d1a3addf 100644 --- a/cmd/test/restapi/api_token_test.go +++ b/cmd/test/restapi/api_token_test.go @@ -1,10 +1,12 @@ package main import ( + "testing" + + commonTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/common" httpHelper "github.com/easysoft/zentaoatf/cmd/test/helper/http" "github.com/ozontech/allure-go/pkg/framework/provider" "github.com/ozontech/allure-go/pkg/framework/suite" - "testing" ) func TestTokenApi(t *testing.T) { @@ -16,7 +18,7 @@ type TokenApiSuite struct { } func (s *TokenApiSuite) BeforeEach(t provider.T) { - t.AddSubSuite("TokenApi") + commonTestHelper.ReplaceLabel(t, "TokenApi") } func (s *TokenApiSuite) TestTokenApi(t provider.T) { diff --git a/cmd/test/ui/ui_bug_test.go b/cmd/test/ui/ui_bug_test.go index 37e49e2f..671e2540 100644 --- a/cmd/test/ui/ui_bug_test.go +++ b/cmd/test/ui/ui_bug_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + commonTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/common" constTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/conf" ztfTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/ztf" "github.com/easysoft/zentaoatf/cmd/test/ui/conf" @@ -15,7 +16,7 @@ import ( func ScriptBug(t provider.T) { t.ID("5747") - t.AddParentSuite("查看bug列表") + commonTestHelper.ReplaceLabel(t, "客户端-查看bug列表") webpage, _ := plwHelper.OpenUrl(constTestHelper.ZtfUrl, t) defer webpage.Close() @@ -44,7 +45,7 @@ func ScriptBug(t provider.T) { func ScriptsBug(t provider.T) { t.ID("5748") - t.AddParentSuite("查看bug列表") + commonTestHelper.ReplaceLabel(t, "客户端-查看bug列表") webpage, _ := plwHelper.OpenUrl(constTestHelper.ZtfUrl, t) defer webpage.Close() diff --git a/cmd/test/ui/ui_interpreter_test.go b/cmd/test/ui/ui_interpreter_test.go index ddb57b68..84b6dcf8 100644 --- a/cmd/test/ui/ui_interpreter_test.go +++ b/cmd/test/ui/ui_interpreter_test.go @@ -3,6 +3,7 @@ package main import ( "testing" + commonTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/common" constTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/conf" plwConf "github.com/easysoft/zentaoatf/cmd/test/ui/conf" plwHelper "github.com/easysoft/zentaoatf/cmd/test/ui/helper" @@ -13,7 +14,7 @@ import ( func CreateInterpreter(t provider.T) { t.ID("5744") - t.AddParentSuite("管理解析器") + commonTestHelper.ReplaceLabel(t, "客户端-管理解析器") webpage, _ := plwHelper.OpenUrl(constTestHelper.ZtfUrl, t) defer webpage.Close() @@ -50,7 +51,7 @@ func CreateInterpreter(t provider.T) { func EditInterpreter(t provider.T) { t.ID("5745") - t.AddParentSuite("管理解析器") + commonTestHelper.ReplaceLabel(t, "客户端-管理解析器") webpage, _ := plwHelper.OpenUrl(constTestHelper.ZtfUrl, t) defer webpage.Close() @@ -71,7 +72,7 @@ func EditInterpreter(t provider.T) { func DeleteInterpreter(t provider.T) { t.ID("5465") - t.AddParentSuite("管理解析器") + commonTestHelper.ReplaceLabel(t, "客户端-管理解析器") webpage, _ := plwHelper.OpenUrl(constTestHelper.ZtfUrl, t) defer webpage.Close() diff --git a/cmd/test/ui/ui_language_test.go b/cmd/test/ui/ui_language_test.go index f24baf52..4750744b 100644 --- a/cmd/test/ui/ui_language_test.go +++ b/cmd/test/ui/ui_language_test.go @@ -3,6 +3,7 @@ package main import ( "testing" + commonTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/common" constTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/conf" plwHelper "github.com/easysoft/zentaoatf/cmd/test/ui/helper" "github.com/ozontech/allure-go/pkg/framework/provider" @@ -11,7 +12,7 @@ import ( func SwitchLanguage(t provider.T) { t.ID("5464") - t.AddParentSuite("设置界面语言") + commonTestHelper.ReplaceLabel(t, "客户端-设置界面语言") webpage, _ := plwHelper.OpenUrl(constTestHelper.ZtfUrl, t) defer webpage.Close() diff --git a/cmd/test/ui/ui_log_test.go b/cmd/test/ui/ui_log_test.go index 7ae3a86f..53c56da1 100644 --- a/cmd/test/ui/ui_log_test.go +++ b/cmd/test/ui/ui_log_test.go @@ -3,6 +3,7 @@ package main import ( "testing" + commonTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/common" constTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/conf" ztfTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/ztf" plwConf "github.com/easysoft/zentaoatf/cmd/test/ui/conf" @@ -13,7 +14,7 @@ import ( func CollapseLog(t provider.T) { t.ID("5502") - t.AddParentSuite("脚本执行日志") + commonTestHelper.ReplaceLabel(t, "客户端-管理脚本执行日志") webpage, _ := plwHelper.OpenUrl(constTestHelper.ZtfUrl, t) defer webpage.Close() @@ -42,7 +43,7 @@ func CollapseLog(t provider.T) { func FullScreenLog(t provider.T) { t.ID("5749") - t.AddParentSuite("脚本执行日志") + commonTestHelper.ReplaceLabel(t, "客户端-管理脚本执行日志") webpage, _ := plwHelper.OpenUrl(constTestHelper.ZtfUrl, t) defer webpage.Close() @@ -63,7 +64,7 @@ func FullScreenLog(t provider.T) { func ClearLog(t provider.T) { t.ID("7540") - t.AddParentSuite("清除测试执行日志") + commonTestHelper.ReplaceLabel(t, "客户端-管理脚本执行日志") webpage, _ := plwHelper.OpenUrl(constTestHelper.ZtfUrl, t) defer webpage.Close() @@ -83,6 +84,6 @@ func ClearLog(t provider.T) { func TestUiLog(t *testing.T) { runner.Run(t, "客户端-展开折叠执行日志", CollapseLog) - runner.Run(t, "客户端-最大化脚本执行日志", FullScreenLog) + runner.Run(t, "客户端-最大化管理脚本执行日志", FullScreenLog) runner.Run(t, "客户端-清空执行日志", ClearLog) } diff --git a/cmd/test/ui/ui_product_test.go b/cmd/test/ui/ui_product_test.go index 1af86926..9afeac05 100644 --- a/cmd/test/ui/ui_product_test.go +++ b/cmd/test/ui/ui_product_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + commonTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/common" constTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/conf" ztfTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/ztf" plwHelper "github.com/easysoft/zentaoatf/cmd/test/ui/helper" @@ -14,7 +15,7 @@ import ( func SwitchProduct(t provider.T) { t.ID("5496") - t.AddParentSuite("切换禅道产品") + commonTestHelper.ReplaceLabel(t, "客户端-切换禅道产品") webpage, _ := plwHelper.OpenUrl(constTestHelper.ZtfUrl, t) defer webpage.Close() diff --git a/cmd/test/ui/ui_proxy_test.go b/cmd/test/ui/ui_proxy_test.go index 8df897b4..8f743642 100644 --- a/cmd/test/ui/ui_proxy_test.go +++ b/cmd/test/ui/ui_proxy_test.go @@ -3,6 +3,7 @@ package main import ( "testing" + commonTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/common" constTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/conf" plwConf "github.com/easysoft/zentaoatf/cmd/test/ui/conf" plwHelper "github.com/easysoft/zentaoatf/cmd/test/ui/helper" @@ -13,7 +14,7 @@ import ( func CreateProxy(t provider.T) { t.ID("5740") - t.AddParentSuite("设置界面语言") + commonTestHelper.ReplaceLabel(t, "客户端-管理代理服务器") webpage, _ := plwHelper.OpenUrl(constTestHelper.ZtfUrl, t) defer webpage.Close() @@ -50,7 +51,7 @@ func CreateProxy(t provider.T) { } func EditProxy(t provider.T) { t.ID("5741") - t.AddParentSuite("设置界面语言") + commonTestHelper.ReplaceLabel(t, "客户端-管理代理服务器") webpage, _ := plwHelper.OpenUrl(constTestHelper.ZtfUrl, t) defer webpage.Close() @@ -72,7 +73,7 @@ func EditProxy(t provider.T) { } func DeleteProxy(t provider.T) { t.ID("5742") - t.AddParentSuite("设置界面语言") + commonTestHelper.ReplaceLabel(t, "客户端-管理代理服务器") webpage, _ := plwHelper.OpenUrl(constTestHelper.ZtfUrl, t) defer webpage.Close() diff --git a/cmd/test/ui/ui_result_test.go b/cmd/test/ui/ui_result_test.go index 8efb3155..e0bd1ba6 100644 --- a/cmd/test/ui/ui_result_test.go +++ b/cmd/test/ui/ui_result_test.go @@ -6,6 +6,7 @@ import ( "testing" "time" + commonTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/common" constTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/conf" apiTest "github.com/easysoft/zentaoatf/cmd/test/helper/zentao/api" ztfTest "github.com/easysoft/zentaoatf/cmd/test/helper/ztf" @@ -19,11 +20,11 @@ import ( func Detail(t provider.T) { t.ID("5489") - t.AddParentSuite("测试结果") + commonTestHelper.ReplaceLabel(t, "客户端-管理测试结果") webpage, _ := plwHelper.OpenUrl(constTestHelper.ZtfUrl, t) defer webpage.Close() - ztfTest.SelectSite(webpage) + ztfTest.SelectSite(webpage, "") ztfTest.ExpandWorspace(webpage) ztfTest.RunScript(webpage, "1_string_match.php") @@ -55,7 +56,7 @@ func Detail(t provider.T) { func SubmitResult(t provider.T) { t.ID("5499") - t.AddParentSuite("测试结果") + commonTestHelper.ReplaceLabel(t, "客户端-管理测试结果") caseInfo := apiTest.GetCaseResult(1) lastId := caseInfo["Id"].(int64) @@ -86,7 +87,7 @@ func SubmitResult(t provider.T) { func SubmitBug(t provider.T) { t.ID("5500") - t.AddParentSuite("测试结果") + commonTestHelper.ReplaceLabel(t, "客户端-管理测试结果") lastId := apiTest.GetLastBugId() @@ -108,7 +109,7 @@ func SubmitBug(t provider.T) { func SubmitBugTwoStep(t provider.T) { t.ID("5500") - t.AddParentSuite("测试结果") + commonTestHelper.ReplaceLabel(t, "客户端-管理测试结果") lastId := apiTest.GetLastBugId() @@ -134,8 +135,8 @@ func SubmitBugTwoStep(t provider.T) { } func TestUiResult(t *testing.T) { - runner.Run(t, "客户端-查看测试结果详情", Detail) - runner.Run(t, "客户端-提交禅道用例脚本测试结果", SubmitResult) + runner.Run(t, "客户端-查看管理测试结果详情", Detail) + runner.Run(t, "客户端-提交禅道用例脚本管理测试结果", SubmitResult) runner.Run(t, "客户端-提交禅道失败用例为缺陷", SubmitBug) runner.Run(t, "客户端-提交禅道部分失败用例为缺陷", SubmitBugTwoStep) } diff --git a/cmd/test/ui/ui_run_from_result_test.go b/cmd/test/ui/ui_run_from_result_test.go index 9f753fe8..b77f2bde 100644 --- a/cmd/test/ui/ui_run_from_result_test.go +++ b/cmd/test/ui/ui_run_from_result_test.go @@ -4,6 +4,7 @@ import ( "strings" "testing" + commonTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/common" constTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/conf" ztfTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/ztf" plwHelper "github.com/easysoft/zentaoatf/cmd/test/ui/helper" @@ -13,7 +14,7 @@ import ( func RunReExecFailCase(t provider.T) { t.ID("5491") - t.AddParentSuite("测试结果页面执行脚本") + commonTestHelper.ReplaceLabel(t, "客户端-结果中重新执行脚本") webpage, _ := plwHelper.OpenUrl(constTestHelper.ZtfUrl, t) defer webpage.Close() @@ -54,7 +55,7 @@ func RunReExecFailCase(t provider.T) { func RunReExecAllCase(t provider.T) { t.ID("5750") - t.AddParentSuite("测试结果页面执行脚本") + commonTestHelper.ReplaceLabel(t, "客户端-结果中重新执行脚本") webpage, _ := plwHelper.OpenUrl(constTestHelper.ZtfUrl, t) defer webpage.Close() diff --git a/cmd/test/ui/ui_run_statistic_test.go b/cmd/test/ui/ui_run_statistic_test.go index b77f1a41..6ea901c6 100644 --- a/cmd/test/ui/ui_run_statistic_test.go +++ b/cmd/test/ui/ui_run_statistic_test.go @@ -4,6 +4,7 @@ import ( "strconv" "testing" + commonTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/common" constTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/conf" ztfTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/ztf" plwHelper "github.com/easysoft/zentaoatf/cmd/test/ui/helper" @@ -16,7 +17,7 @@ var runStatisticPage playwright.Page func RunFailStatistic(t provider.T) { t.ID("5487") - t.AddParentSuite("执行脚本") + commonTestHelper.ReplaceLabel(t, "客户端-执行统计信息") webpage, _ := plwHelper.OpenUrl(constTestHelper.ZtfUrl, t) defer webpage.Close() @@ -52,7 +53,7 @@ func RunFailStatistic(t provider.T) { func RunSuccessStatistic(t provider.T) { t.ID("5487") - t.AddParentSuite("执行脚本") + commonTestHelper.ReplaceLabel(t, "客户端-执行统计信息") webpage, _ := plwHelper.OpenUrl(constTestHelper.ZtfUrl, t) defer webpage.Close() @@ -93,7 +94,7 @@ func RunSuccessStatistic(t provider.T) { func RunBugStatistic(t provider.T) { t.ID("5487") - t.AddParentSuite("执行脚本") + commonTestHelper.ReplaceLabel(t, "客户端-执行统计信息") webpage, _ := plwHelper.OpenUrl(constTestHelper.ZtfUrl, t) defer webpage.Close() diff --git a/cmd/test/ui/ui_run_test.go b/cmd/test/ui/ui_run_test.go index 0d074fc2..86b4e6e0 100644 --- a/cmd/test/ui/ui_run_test.go +++ b/cmd/test/ui/ui_run_test.go @@ -19,7 +19,7 @@ import ( func RunScript(t provider.T) { t.ID("5743") - t.AddParentSuite("执行脚本") + commonTestHelper.ReplaceLabel(t, "客户端-执行脚本") webpage, _ := plwHelper.OpenUrl(constTestHelper.ZtfUrl, t) defer webpage.Close() @@ -52,7 +52,7 @@ func RunScript(t provider.T) { func CheckStep(t provider.T) { t.ID("7609") - t.AddParentSuite("执行脚本") + commonTestHelper.ReplaceLabel(t, "客户端-执行脚本") webpage, _ := plwHelper.OpenUrl(constTestHelper.ZtfUrl, t) defer webpage.Close() @@ -89,7 +89,7 @@ func CheckStep(t provider.T) { func RunScriptByRightClick(t provider.T) { t.ID("5479") - t.AddParentSuite("执行脚本") + commonTestHelper.ReplaceLabel(t, "客户端-执行脚本") webpage, _ := plwHelper.OpenUrl(constTestHelper.ZtfUrl, t) defer webpage.Close() @@ -120,7 +120,7 @@ func RunScriptByRightClick(t provider.T) { func RunNoInterpreterScript(t provider.T) { t.ID("5501") - t.AddParentSuite("执行脚本") + commonTestHelper.ReplaceLabel(t, "客户端-执行脚本") webpage, _ := plwHelper.OpenUrl(constTestHelper.ZtfUrl, t) defer webpage.Close() @@ -135,7 +135,7 @@ func RunNoInterpreterScript(t provider.T) { func RunSelectedScripts(t provider.T) { t.ID("5481") - t.AddParentSuite("执行脚本") + commonTestHelper.ReplaceLabel(t, "客户端-执行脚本") webpage, _ := plwHelper.OpenUrl(constTestHelper.ZtfUrl, t) defer webpage.Close() @@ -173,7 +173,7 @@ func RunSelectedScripts(t provider.T) { func RunOpenedAndLast(t provider.T) { t.ID("5484") - t.AddParentSuite("执行脚本") + commonTestHelper.ReplaceLabel(t, "客户端-执行脚本") webpage, _ := plwHelper.OpenUrl(constTestHelper.ZtfUrl, t) defer webpage.Close() @@ -227,7 +227,7 @@ func RunOpenedAndLast(t provider.T) { func RunAll(t provider.T) { t.ID("5485") - t.AddParentSuite("执行脚本") + commonTestHelper.ReplaceLabel(t, "客户端-执行脚本") os.RemoveAll(commonTestHelper.GetZtfProductPath()) os.Remove(commonTestHelper.GetPhpWorkspacePath() + "1.php") @@ -268,7 +268,7 @@ func RunAll(t provider.T) { func RunWorkspace(t provider.T) { t.ID("5482") - t.AddParentSuite("执行脚本") + commonTestHelper.ReplaceLabel(t, "客户端-执行脚本") webpage, _ := plwHelper.OpenUrl(constTestHelper.ZtfUrl, t) defer webpage.Close() @@ -315,7 +315,7 @@ func RunWorkspace(t provider.T) { func RunDir(t provider.T) { t.ID("5480") - t.AddParentSuite("执行脚本") + commonTestHelper.ReplaceLabel(t, "客户端-执行脚本") webpage, _ := plwHelper.OpenUrl(constTestHelper.ZtfUrl, t) defer webpage.Close() @@ -344,7 +344,7 @@ func RunDir(t provider.T) { func RunUseProxy(t provider.T) { t.ID("5746") - t.AddParentSuite("执行脚本") + commonTestHelper.ReplaceLabel(t, "客户端-执行脚本") webpage, _ := plwHelper.OpenUrl(constTestHelper.ZtfUrl, t) defer webpage.Close() diff --git a/cmd/test/ui/ui_run_unit_test.go b/cmd/test/ui/ui_run_unit_test.go index 75e779ac..0874c04c 100644 --- a/cmd/test/ui/ui_run_unit_test.go +++ b/cmd/test/ui/ui_run_unit_test.go @@ -46,7 +46,7 @@ func RunTestNG(t provider.T) { shellUtils.ExeShellWithOutputInDir("mvn clean package test", testngDir) t.ID("5432") - t.AddParentSuite("执行单元测试") + commonTestHelper.ReplaceLabel(t, "客户端-执行单元测试") webpage, _ := plwHelper.OpenUrl(constTestHelper.ZtfUrl, t) defer webpage.Close() diff --git a/cmd/test/ui/ui_script_test.go b/cmd/test/ui/ui_script_test.go index 6854bcdc..a3a20d6a 100644 --- a/cmd/test/ui/ui_script_test.go +++ b/cmd/test/ui/ui_script_test.go @@ -3,6 +3,7 @@ package main import ( "testing" + commonTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/common" constTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/conf" ztfTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/ztf" plwHelper "github.com/easysoft/zentaoatf/cmd/test/ui/helper" @@ -13,7 +14,7 @@ import ( func SaveScript(t provider.T) { t.ID("5470") - t.AddParentSuite("禅道站点脚本") + commonTestHelper.ReplaceLabel(t, "客户端-管理禅道站点脚本") webpage, _ := plwHelper.OpenUrl(constTestHelper.ZtfUrl, t) defer webpage.Close() ztfTestHelper.SelectSite(webpage, "") @@ -42,7 +43,7 @@ func SaveScript(t provider.T) { func ViewScript(t provider.T) { t.ID("5469") - t.AddParentSuite("禅道站点脚本") + commonTestHelper.ReplaceLabel(t, "客户端-管理禅道站点脚本") webpage, _ := plwHelper.OpenUrl(constTestHelper.ZtfUrl, t) defer webpage.Close() ztfTestHelper.SelectSite(webpage, "") @@ -54,7 +55,7 @@ func ViewScript(t provider.T) { func SwitchScript(t provider.T) { t.ID("7583") - t.AddParentSuite("脚本切换和关闭") + commonTestHelper.ReplaceLabel(t, "客户端-管理禅道站点脚本") webpage, _ := plwHelper.OpenUrl(constTestHelper.ZtfUrl, t) defer webpage.Close() @@ -79,7 +80,7 @@ func SwitchScript(t provider.T) { } func TestUiScript(t *testing.T) { - runner.Run(t, "客户端-编辑保存禅道站点脚本", SaveScript) - runner.Run(t, "客户端-显示禅道站点脚本", ViewScript) - runner.Run(t, "客户端-切换禅道站点脚本", SwitchScript) + runner.Run(t, "客户端-编辑保存管理禅道站点脚本", SaveScript) + runner.Run(t, "客户端-显示管理禅道站点脚本", ViewScript) + runner.Run(t, "客户端-切换管理禅道站点脚本", SwitchScript) } diff --git a/cmd/test/ui/ui_server_test.go b/cmd/test/ui/ui_server_test.go index 264dac4e..449f6470 100644 --- a/cmd/test/ui/ui_server_test.go +++ b/cmd/test/ui/ui_server_test.go @@ -3,6 +3,7 @@ package main import ( "testing" + commonTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/common" constTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/conf" plwConf "github.com/easysoft/zentaoatf/cmd/test/ui/conf" plwHelper "github.com/easysoft/zentaoatf/cmd/test/ui/helper" @@ -13,7 +14,7 @@ import ( func CreateServer(t provider.T) { t.ID("5737") - t.AddParentSuite("管理服务器") + commonTestHelper.ReplaceLabel(t, "客户端-管理服务器") webpage, _ := plwHelper.OpenUrl(constTestHelper.ZtfUrl, t) defer webpage.Close() @@ -34,7 +35,7 @@ func CreateServer(t provider.T) { func EditServer(t provider.T) { t.ID("5738") - t.AddParentSuite("管理服务器") + commonTestHelper.ReplaceLabel(t, "客户端-管理服务器") webpage, _ := plwHelper.OpenUrl(constTestHelper.ZtfUrl, t) defer webpage.Close() @@ -55,7 +56,7 @@ func EditServer(t provider.T) { func DeleteServer(t provider.T) { t.ID("5739") - t.AddParentSuite("管理服务器") + commonTestHelper.ReplaceLabel(t, "客户端-管理服务器") webpage, _ := plwHelper.OpenUrl(constTestHelper.ZtfUrl, t) defer webpage.Close() diff --git a/cmd/test/ui/ui_site_test.go b/cmd/test/ui/ui_site_test.go index 6baa5339..c137a2bb 100644 --- a/cmd/test/ui/ui_site_test.go +++ b/cmd/test/ui/ui_site_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + commonTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/common" constTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/conf" plwConf "github.com/easysoft/zentaoatf/cmd/test/ui/conf" plwHelper "github.com/easysoft/zentaoatf/cmd/test/ui/helper" @@ -14,7 +15,7 @@ import ( func CreateSite(t provider.T) { t.ID("5466") - t.AddParentSuite("配置禅道站点") + commonTestHelper.ReplaceLabel(t, "客户端-管理禅道站点") webpage, _ := plwHelper.OpenUrl(constTestHelper.ZtfUrl, t) defer webpage.Close() @@ -38,7 +39,7 @@ func CreateSite(t provider.T) { func CreateSiteWithFullUrl(t provider.T) { t.ID("7575") - t.AddParentSuite("禅道站点URL格式兼容") + commonTestHelper.ReplaceLabel(t, "客户端-管理禅道站点") webpage, _ := plwHelper.OpenUrl(constTestHelper.ZtfUrl, t) defer webpage.Close() @@ -56,13 +57,13 @@ func CreateSiteWithFullUrl(t provider.T) { locator.FillNth(3, constTestHelper.ZentaoPassword) webpage.Click("text=确定") - webpage.WaitForSelector("fmt.Sprintf(".list-item-content span:has-text('%s')", constTestHelper.SiteName)") + webpage.WaitForSelector(fmt.Sprintf(".list-item-content span:has-text('%s')", constTestHelper.SiteName)) locator = webpage.Locator(".list-item-content span", playwright.PageLocatorOptions{HasText: constTestHelper.SiteName}) } func EditSite(t provider.T) { t.ID("5466") - t.AddParentSuite("配置禅道站点") + commonTestHelper.ReplaceLabel(t, "客户端-管理禅道站点") webpage, _ := plwHelper.OpenUrl(constTestHelper.ZtfUrl, t) defer webpage.Close() @@ -94,11 +95,11 @@ func EditSite(t provider.T) { webpage.Click("#siteFormModal>>.modal-action>>span:has-text(\"确定\")") webpage.WaitForSelector(fmt.Sprintf(".list-item-content span:has-text('%s-update')", constTestHelper.SiteName)) - locator = webpage.Locator(".list-item-content span", playwright.PageLocatorOptions{HasText: constTestHelper.SiteName+"-update"}) + locator = webpage.Locator(".list-item-content span", playwright.PageLocatorOptions{HasText: constTestHelper.SiteName + "-update"}) } func DeleteSite(t provider.T) { t.ID("5466") - t.AddParentSuite("配置禅道站点") + commonTestHelper.ReplaceLabel(t, "客户端-管理禅道站点") webpage, _ := plwHelper.OpenUrl(constTestHelper.ZtfUrl, t) defer webpage.Close() @@ -113,7 +114,7 @@ func DeleteSite(t provider.T) { webpage.WaitForTimeout(1000) webpage.Click(":nth-match(.modal-action > button, 1)") - webpage.WaitForSelector("fmt.Sprintf(".list-item-content span:has-text('%s')", constTestHelper.SiteName)", playwright.PageWaitForSelectorOptions{State: playwright.WaitForSelectorStateDetached}) + webpage.WaitForSelector(fmt.Sprintf(".list-item-content span:has-text('%s')", constTestHelper.SiteName), playwright.PageWaitForSelectorOptions{State: playwright.WaitForSelectorStateDetached}) plwConf.DisableErr() defer plwConf.EnableErr() diff --git a/cmd/test/ui/ui_workspace_filter_test.go b/cmd/test/ui/ui_workspace_filter_test.go index 09ea875b..6aed0b4f 100644 --- a/cmd/test/ui/ui_workspace_filter_test.go +++ b/cmd/test/ui/ui_workspace_filter_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + commonTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/common" constTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/conf" ztfTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/ztf" plwHelper "github.com/easysoft/zentaoatf/cmd/test/ui/helper" @@ -13,7 +14,7 @@ import ( func FilterDir(t provider.T) { t.ID("5494") - t.AddParentSuite("管理禅道站点下工作目录") + commonTestHelper.ReplaceLabel(t, "客户端-过滤禅道站点下工作目录") webpage, _ := plwHelper.OpenUrl(constTestHelper.ZtfUrl, t) defer webpage.Close() @@ -35,7 +36,7 @@ func FilterDir(t provider.T) { } func FilterSuite(t provider.T) { t.ID("5495") - t.AddParentSuite("管理禅道站点下工作目录") + commonTestHelper.ReplaceLabel(t, "客户端-过滤禅道站点下工作目录") webpage, _ := plwHelper.OpenUrl(constTestHelper.ZtfUrl, t) defer webpage.Close() @@ -58,7 +59,7 @@ func FilterSuite(t provider.T) { } func ByModule(t provider.T) { t.ID("5493") - t.AddParentSuite("管理禅道站点下工作目录") + commonTestHelper.ReplaceLabel(t, "客户端-过滤禅道站点下工作目录") webpage, _ := plwHelper.OpenUrl(constTestHelper.ZtfUrl, t) defer webpage.Close() @@ -79,7 +80,7 @@ func ByModule(t provider.T) { } func FilterTask(t provider.T) { t.ID("5496") - t.AddParentSuite("管理禅道站点下工作目录") + commonTestHelper.ReplaceLabel(t, "客户端-过滤禅道站点下工作目录") webpage, _ := plwHelper.OpenUrl(constTestHelper.ZtfUrl, t) defer webpage.Close() diff --git a/cmd/test/ui/ui_workspace_test.go b/cmd/test/ui/ui_workspace_test.go index bdc8f82c..e0a03c9e 100644 --- a/cmd/test/ui/ui_workspace_test.go +++ b/cmd/test/ui/ui_workspace_test.go @@ -29,7 +29,7 @@ var ( func MangeWorkspace(t provider.T) { t.ID("5468") - t.AddParentSuite("管理禅道站点下工作目录") + commonTestHelper.ReplaceLabel(t, "客户端-管理禅道站点下工作目录") webpage, _ := plwHelper.OpenUrl(constTestHelper.ZtfUrl, t) defer webpage.Close() @@ -45,7 +45,7 @@ func MangeWorkspace(t provider.T) { func MangeLocalWorkspace(t provider.T) { t.ID("5467") - t.AddParentSuite("管理本地站点下工作目录") + commonTestHelper.ReplaceLabel(t, "客户端-管理本地站点下工作目录") webpage, _ := plwHelper.OpenUrl(constTestHelper.ZtfUrl, t) defer webpage.Close() @@ -204,7 +204,7 @@ func syncCaseFromZentaoSuite(t provider.T) { func SyncTwoCaseFromZentao(t provider.T) { t.ID("5752") - t.AddParentSuite("管理禅道站点下工作目录") + commonTestHelper.ReplaceLabel(t, "客户端-管理禅道站点下工作目录") webpage, _ := plwHelper.OpenUrl(constTestHelper.ZtfUrl, t) defer webpage.Close() @@ -236,7 +236,7 @@ func SyncTwoCaseFromZentao(t provider.T) { func SyncToZentao(t provider.T) { t.ID("5431") - t.AddParentSuite("管理禅道站点下工作目录") + commonTestHelper.ReplaceLabel(t, "客户端-管理禅道站点下工作目录") //update script title scriptPath := filepath.Join(workspacePath, "2_webpage_extract.php") @@ -266,7 +266,7 @@ func SyncToZentao(t provider.T) { func Copy(t provider.T) { t.ID("5474") - t.AddParentSuite("管理禅道站点下工作目录") + commonTestHelper.ReplaceLabel(t, "客户端-管理禅道站点下工作目录") fileUtils.MkDirIfNeeded(syncDir) defer os.RemoveAll(syncDir) @@ -299,7 +299,7 @@ func Copy(t provider.T) { func ClipAndCopyDir(t provider.T) { t.ID("5473,7593") - t.AddParentSuite("管理禅道站点下工作目录") + commonTestHelper.ReplaceLabel(t, "客户端-管理禅道站点下工作目录") CopyDir(t) ClipDir(t) @@ -377,7 +377,7 @@ func ClipDir(t provider.T) { func CreateScript(t provider.T) { // t.ID("7596") - // t.AddParentSuite("管理禅道站点下工作目录") + // commonTestHelper.ReplaceLabel(t, "客户端-管理禅道站点下工作目录") webpage, _ := plwHelper.OpenUrl(constTestHelper.ZtfUrl, t) defer webpage.Close() @@ -400,7 +400,7 @@ func CreateScript(t provider.T) { func RenameScript(t provider.T) { t.ID("7596") - t.AddParentSuite("管理禅道站点下工作目录") + commonTestHelper.ReplaceLabel(t, "客户端-管理禅道站点下工作目录") fileUtils.MkDirIfNeeded(syncDir) @@ -431,7 +431,7 @@ func RenameScript(t provider.T) { func CreateDir(t provider.T) { // t.ID("7596") - // t.AddParentSuite("管理禅道站点下工作目录") + // commonTestHelper.ReplaceLabel(t, "客户端-管理禅道站点下工作目录") webpage, _ := plwHelper.OpenUrl(constTestHelper.ZtfUrl, t) defer webpage.Close() @@ -454,7 +454,7 @@ func CreateDir(t provider.T) { func RenameDir(t provider.T) { t.ID("7595") - t.AddParentSuite("管理禅道站点下工作目录") + commonTestHelper.ReplaceLabel(t, "客户端-管理禅道站点下工作目录") fileUtils.MkDirIfNeeded(syncDir) defer os.RemoveAll(syncDir) @@ -481,7 +481,7 @@ func RenameDir(t provider.T) { func DeleteScript(t provider.T) { t.ID("5478") - t.AddParentSuite("管理禅道站点下工作目录") + commonTestHelper.ReplaceLabel(t, "客户端-管理禅道站点下工作目录") fileUtils.MkDirIfNeeded(syncDir) scriptPath := filepath.Join(workspacePath, "product1", "1.php") @@ -514,7 +514,7 @@ func DeleteScript(t provider.T) { } func DeleteDir(t provider.T) { t.ID("5477") - t.AddParentSuite("管理禅道站点下工作目录") + commonTestHelper.ReplaceLabel(t, "客户端-管理禅道站点下工作目录") fileUtils.MkDirIfNeeded(syncDir) defer os.RemoveAll(syncDir) @@ -562,7 +562,7 @@ func DeleteWorkspace(t provider.T, webpage plwHelper.Webpage) { } func Clip(t provider.T) { t.ID("5476") - t.AddParentSuite("管理禅道站点下工作目录") + commonTestHelper.ReplaceLabel(t, "客户端-管理禅道站点下工作目录") fileUtils.MkDirIfNeeded(syncDir) scriptPath := filepath.Join(workspacePath, "product1", "1.php") @@ -595,7 +595,7 @@ func Clip(t provider.T) { func Collapse(t provider.T) { t.ID("5472") - t.AddParentSuite("管理禅道站点下工作目录") + commonTestHelper.ReplaceLabel(t, "客户端-管理禅道站点下工作目录") webpage, _ := plwHelper.OpenUrl(constTestHelper.ZtfUrl, t) defer webpage.Close() diff --git a/go.mod b/go.mod index c4948bd1..4cf43eaf 100644 --- a/go.mod +++ b/go.mod @@ -36,6 +36,7 @@ require ( github.com/mitchellh/mapstructure v1.4.2 // indirect github.com/nats-io/nats-server/v2 v2.7.2 // indirect github.com/otiai10/copy v1.7.0 + github.com/ozontech/allure-go/pkg/allure v0.6.4 // indirect github.com/ozontech/allure-go/pkg/framework v0.6.18 github.com/playwright-community/playwright-go v0.2000.1 github.com/robfig/cron/v3 v3.0.1 diff --git a/internal/pkg/helper/exec/report-unit.go b/internal/pkg/helper/exec/report-unit.go index 60c21bbc..d9ea4479 100644 --- a/internal/pkg/helper/exec/report-unit.go +++ b/internal/pkg/helper/exec/report-unit.go @@ -4,7 +4,6 @@ import ( "encoding/json" "encoding/xml" "fmt" - "github.com/jinzhu/copier" "io/ioutil" "os" "path" @@ -15,6 +14,8 @@ import ( "strings" "time" + "github.com/jinzhu/copier" + commConsts "github.com/easysoft/zentaoatf/internal/pkg/consts" commDomain "github.com/easysoft/zentaoatf/internal/pkg/domain" websocketHelper "github.com/easysoft/zentaoatf/internal/pkg/helper/websocket" @@ -147,7 +148,7 @@ func genUnitFailedMsg(failedCaseLines []string, failedCaseLinesDesc []string) st msg := divider msg += "\n" + color.New(color.Bold, color.FgHiWhite).Sprint(i118Utils.Sprintf("failed_scripts")) + "\n" - msg += strings.Join(failedCaseLines, "\n") + msg += strings.Join(failedCaseLines, "\n") + "\n" msg += strings.Join(failedCaseLinesDesc, "\n") msg += "\n\n" + divider diff --git a/internal/pkg/helper/exec/result.go b/internal/pkg/helper/exec/result.go index 339f72ae..ce92a43f 100644 --- a/internal/pkg/helper/exec/result.go +++ b/internal/pkg/helper/exec/result.go @@ -86,8 +86,8 @@ func ValidateCaseResult(execParams commDomain.ExecParams, langType string, statusWithColor, status := GenStatusTxt(csResult.Status) - msg := fmt.Sprintf(format, execParams.ScriptIdx+1, len(execParams.CasesToRun), status, path, csTitle, execParams.Secs) - msgWithColor := fmt.Sprintf(format, execParams.ScriptIdx+1, len(execParams.CasesToRun), statusWithColor, path, csTitle, execParams.Secs) + msg := fmt.Sprintf(format, len(execParams.Report.FuncResult), len(execParams.CasesToRun), status, path, csTitle, execParams.Secs) + msgWithColor := fmt.Sprintf(format, len(execParams.Report.FuncResult), len(execParams.CasesToRun), statusWithColor, path, csTitle, execParams.Secs) // print each case result if commConsts.ExecFrom == commConsts.FromClient { -- GitLab