diff --git a/cmd/command/main.go b/cmd/command/main.go
index fc35305eb53c804d66fd62fc15b4ec4b1fc3f8a7..def27847cf4eb7b702c81737632eaa10b697a52a 100644
--- a/cmd/command/main.go
+++ b/cmd/command/main.go
@@ -22,10 +22,11 @@ var (
independentFile bool
keywords string
- productId string
- moduleId string
- taskId string
- suiteId string
+ productId string
+ moduleId string
+ taskIdOrName string
+ suiteId string
+ taskName string
noNeedConfirm bool
@@ -52,8 +53,8 @@ func main() {
flagSet.StringVar(&suiteId, "s", "", "")
flagSet.StringVar(&suiteId, "suite", "", "")
- flagSet.StringVar(&taskId, "t", "", "")
- flagSet.StringVar(&taskId, "task", "", "")
+ flagSet.StringVar(&taskIdOrName, "t", "", "")
+ flagSet.StringVar(&taskIdOrName, "task", "", "")
flagSet.StringVar(&language, "l", "", "")
flagSet.StringVar(&language, "language", "", "")
@@ -96,7 +97,7 @@ func main() {
case "checkout", "co":
if err := flagSet.Parse(os.Args[2:]); err == nil {
- action.Checkout(productId, moduleId, suiteId, taskId, independentFile, language)
+ action.Checkout(productId, moduleId, suiteId, taskIdOrName, independentFile, language)
}
case "ci":
@@ -108,8 +109,8 @@ func main() {
case "cr":
files := fileUtils.GetFilesFromParams(os.Args[2:])
if err := flagSet.Parse(os.Args[len(files)+2:]); err == nil {
- action.CommitZTFTestResult(files, stringUtils.ParseInt(productId), stringUtils.ParseInt(taskId),
- noNeedConfirm)
+ action.CommitZTFTestResult(files, stringUtils.ParseInt(productId),
+ taskIdOrName, noNeedConfirm)
}
case "cb":
@@ -166,7 +167,7 @@ func run(args []string) {
if commConsts.AutoCommitResult && productId != "" {
action.CommitZTFTestResult([]string{commConsts.ExecLogDir},
- stringUtils.ParseInt(productId), stringUtils.ParseInt(productId), true)
+ stringUtils.ParseInt(productId), taskIdOrName, true)
}
if commConsts.AutoCommitBug && productId != "" {
@@ -198,7 +199,7 @@ func runFuncTest(args []string) {
msgStr := i118Utils.Sprintf("run_with_specific_interpreter", commConsts.Interpreter)
logUtils.ExecConsolef(color.FgCyan, msgStr)
}
- action.RunZTFTest(files, moduleId, suiteId, taskId)
+ action.RunZTFTest(files, moduleId, suiteId, taskIdOrName)
}
func runUnitTest(args []string) {
diff --git a/internal/command/action/ztfResult.go b/internal/command/action/ztfResult.go
index d2f1fd0c955dc296a05d63119bfeab001dcc3467..9cf501da4fb2f1bc134f87a7c40ac04bbbec20d1 100644
--- a/internal/command/action/ztfResult.go
+++ b/internal/command/action/ztfResult.go
@@ -12,7 +12,7 @@ import (
"strconv"
)
-func CommitZTFTestResult(files []string, productId, taskId int, noNeedConfirm bool) {
+func CommitZTFTestResult(files []string, productId int, taskIdOrName string, noNeedConfirm bool) {
var resultDir string
if len(files) > 0 {
resultDir = files[0]
@@ -26,6 +26,12 @@ func CommitZTFTestResult(files []string, productId, taskId int, noNeedConfirm bo
productId, _ = strconv.Atoi(productIdStr)
}
+ taskName := ""
+ taskId, err := strconv.Atoi(taskIdOrName)
+ if err != nil {
+ taskName = taskIdOrName
+ }
+
if taskId == 0 && !noNeedConfirm {
taskIdStr := stdinUtils.GetInput("\\d*", "",
i118Utils.Sprintf("pls_enter")+" "+i118Utils.Sprintf("task_id")+
@@ -36,6 +42,7 @@ func CommitZTFTestResult(files []string, productId, taskId int, noNeedConfirm bo
result := serverDomain.ZentaoResultSubmitReq{
ProductId: productId,
TaskId: taskId,
+ Name: taskName,
Seq: resultDir,
}
diff --git a/internal/pkg/domain/testing.go b/internal/pkg/domain/testing.go
index 8bdbd30b4216ebe8d953f0c026c44268d395a86e..f6ce1ad5fd5d1bf06de72d612ac842fe1a4e1246 100644
--- a/internal/pkg/domain/testing.go
+++ b/internal/pkg/domain/testing.go
@@ -146,6 +146,8 @@ type ZentaoBug struct {
}
type ZtfReport struct {
+ Name string `json:"name"`
+
TestEnv commConsts.OsType `json:"testEnv,omitempty"`
TestType commConsts.TestType `json:"testType"`
TestTool commConsts.TestTool `json:"testTool"`
diff --git a/internal/pkg/helper/exec/report-unit.go b/internal/pkg/helper/exec/report-unit.go
index cbda99936cec6bb47789f3d8d38cdf0d7c5e3c15..52da4b89736b838688709995cafe039fa1d6b0bf 100644
--- a/internal/pkg/helper/exec/report-unit.go
+++ b/internal/pkg/helper/exec/report-unit.go
@@ -43,6 +43,7 @@ func GenUnitTestReport(req serverDomain.TestSet, startTime, endTime int64,
}
report = commDomain.ZtfReport{
+ Name: req.Name,
TestEnv: commonUtils.GetOs(),
TestType: commConsts.TestUnit,
TestTool: req.TestTool,
diff --git a/internal/server/modules/v1/domain/webscoket.go b/internal/server/modules/v1/domain/webscoket.go
index 1666c638d6a2de639534215c00e2bac846d6c1de..408d3b211942529f35408b8824c7cf68e9c47f32 100644
--- a/internal/server/modules/v1/domain/webscoket.go
+++ b/internal/server/modules/v1/domain/webscoket.go
@@ -26,6 +26,8 @@ type WsReq struct {
}
type TestSet struct {
+ Name string `json:"name"`
+
WorkspaceId int `json:"workspaceId"`
WorkspaceType commConsts.TestTool `json:"workspaceType"`
WorkspacePath string `json:"workspacePath"`
diff --git a/internal/server/modules/v1/domain/zentao.go b/internal/server/modules/v1/domain/zentao.go
index aefdc24d5a34a481af40ef088f54303d9c784b46..949724780ba7cbe48f916e6525b72a3f0201c60d 100644
--- a/internal/server/modules/v1/domain/zentao.go
+++ b/internal/server/modules/v1/domain/zentao.go
@@ -10,7 +10,7 @@ type ZentaoRespData struct {
}
type ZentaoResultSubmitReq struct {
- Title string `json:"title"`
+ Name string `json:"name"`
Seq string `json:"seq"`
WorkspaceId int `json:"workspaceId"`
ProductId int `json:"productId"`
diff --git a/internal/server/modules/v1/service/test-result.go b/internal/server/modules/v1/service/test-result.go
index 8dcd77728d07c66e9bb2db4c5458346939706c94..1a2ecaa6b591ef0daff2cc421bd2a658cf2c1739 100644
--- a/internal/server/modules/v1/service/test-result.go
+++ b/internal/server/modules/v1/service/test-result.go
@@ -150,6 +150,7 @@ func (s *TestResultService) Submit(result serverDomain.ZentaoResultSubmitReq, si
}
config := configHelper.LoadBySite(site)
+ report.Name = result.Name
err = zentaoHelper.CommitResult(report, result.ProductId, result.TaskId, config, nil)
return
diff --git a/ui/src/locales/en-US.ts b/ui/src/locales/en-US.ts
index 1a0a9c64ddc4036f8f83c7ddb2ead52f43327bf0..b70ed5894858f4e7ea191901340afb2094430439 100644
--- a/ui/src/locales/en-US.ts
+++ b/ui/src/locales/en-US.ts
@@ -226,6 +226,8 @@ export default {
'pls_select_task': 'Please select task',
'or_input_task_name': 'Or input new task name',
+ 'task_name': 'Zentao Task Name',
+
'pls_select_workspace': 'Please select workspace.',
'pls_add_zentao_site': 'Please add zentao site.',
'pls_create_workspace': 'Please create workspace to continue.',
diff --git a/ui/src/locales/zh-CN.ts b/ui/src/locales/zh-CN.ts
index 12b3c591a99b9f2a81112626345742187530c61b..3cd3abd1b91c380ac29a237da98c49dcf571a9d2 100644
--- a/ui/src/locales/zh-CN.ts
+++ b/ui/src/locales/zh-CN.ts
@@ -237,6 +237,7 @@ export default {
'pls_select_task': '请选择任务',
'or_input_task_name': '或输入新任务标题',
+ 'task_name': '禅道任务标题',
'pls_select_workspace': '请选择导出到的工作目录。',
'pls_add_zentao_site': '初次使用,请点击右上按钮新建禅道站点。',
diff --git a/ui/src/views/exec/LogList.vue b/ui/src/views/exec/LogList.vue
index 7d1825c80c384826af6aa8cf99de2b7a72520baf..3f56128ffee5ab165ef7119a4d932c922048fe96 100644
--- a/ui/src/views/exec/LogList.vue
+++ b/ui/src/views/exec/LogList.vue
@@ -168,7 +168,7 @@ const exec = (data: any) => {
msg = {act: 'execCase', testSets: sets}
} else if (execType === 'unit') {
- const set = {workspaceId: data.id, workspaceType: data.type, cmd: data.cmd, submitResult: data.submitResult}
+ const set = {workspaceId: data.id, workspaceType: data.type, cmd: data.cmd, submitResult: data.submitResult, name: data.name}
msg = {act: 'execUnit', testSets: [set]}
diff --git a/ui/src/views/exec/TabPageExecUnit.vue b/ui/src/views/exec/TabPageExecUnit.vue
index 881e829d1b10004f00251b2d3c7e1a3af57c6750..099c73e17e7c74c9a58a404b6a527b2df383be78 100644
--- a/ui/src/views/exec/TabPageExecUnit.vue
+++ b/ui/src/views/exec/TabPageExecUnit.vue
@@ -9,6 +9,10 @@
+
+
+
+
-
-
+
+