From 636654e18f9774b2f7629a8e850bedfebe55f222 Mon Sep 17 00:00:00 2001 From: aaron <462826@qq.com> Date: Wed, 31 May 2023 17:50:22 +0800 Subject: [PATCH] support set more than one id for unit testcase --- test/restapi/api_product_test.go | 4 ++-- test/restapi/api_result_test.go | 2 +- test/restapi/main.go | 12 +++++++----- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/test/restapi/api_product_test.go b/test/restapi/api_product_test.go index f545b0c4..c1525806 100644 --- a/test/restapi/api_product_test.go +++ b/test/restapi/api_product_test.go @@ -25,7 +25,7 @@ func (s *ProductApiSuite) BeforeEach(t provider.T) { } func (s *ProductApiSuite) TestProductListApi(t provider.T) { - t.ID("7620") + t.ID("7639") //t.ID("1") token := httpHelper.Login() @@ -40,7 +40,7 @@ func (s *ProductApiSuite) TestProductListApi(t provider.T) { } func (s *ProductApiSuite) TestProductDetailApi(t provider.T) { - t.ID("7621") + t.ID("7640") //t.ID("2") token := httpHelper.Login() diff --git a/test/restapi/api_result_test.go b/test/restapi/api_result_test.go index 2b0e49ae..a1550004 100644 --- a/test/restapi/api_result_test.go +++ b/test/restapi/api_result_test.go @@ -48,7 +48,7 @@ func (s *ResultApiSuite) TestResultSubmitZtfResultApi(t provider.T) { // check case result latestIdNew := getCaseResult(config.CaseId)["latestId"].(int64) - t.Require().Equal(latestIdNew, latestId+1, "submit result failed") + t.Require().Greater(latestIdNew, latestId, "submit result failed") // check task record tasksBytes := listTask(token) diff --git a/test/restapi/main.go b/test/restapi/main.go index 1a05a0fe..4d307ddb 100644 --- a/test/restapi/main.go +++ b/test/restapi/main.go @@ -100,21 +100,23 @@ func doTest(testToRun string) (err error) { req := serverDomain.TestSet{ WorkspacePath: testPath, - Cmd: fmt.Sprintf("go test restapi/%s -v", testToRun), + Cmd: fmt.Sprintf("go test %s -v", testToRun), TestTool: commConsts.GoTest, } fmt.Println(testPath, req.Cmd) // exec testing report := execSuite(req, "restapi") + report.ProductId = 82 // submit result for test if runFrom != "jenkins" { config := commDomain.WorkspaceConf{ - Url: "http://110.42.146.127:50080", - Username: "admin", - Password: "P2ssw0rd"} - err = zentaoHelper.CommitResult(report, 1, 0, config, nil) + Url: "https://back.zcorp.cc/pms", + Username: "chenqi", + Password: "th2ISxOVXcoUiMLazk1b"} + err = zentaoHelper.CommitResult(report, report.ProductId, 0, config, nil) + } return -- GitLab