提交 7b72e5ac 编写于 作者: Z zhaoke

Merge branch 'morden-ui' of github.com:easysoft/zentaoatf into morden-ui

......@@ -222,6 +222,9 @@ func runUnitTest(args []string) {
start = start + 2
commConsts.ProductId = productId
}
if taskIdOrName != "" {
start = start + 2
}
if commConsts.Verbose {
start = start + 1
}
......@@ -230,7 +233,7 @@ func runUnitTest(args []string) {
cmd := strings.Join(args[start:], " ")
action.RunUnitTest(cmd)
action.RunUnitTest(cmd, taskIdOrName)
}
func init() {
......
......@@ -7,7 +7,7 @@ import (
stringUtils "github.com/easysoft/zentaoatf/pkg/lib/string"
)
func RunUnitTest(cmdStr string) {
func RunUnitTest(cmdStr string, taskIdOrName string) {
testSet := serverDomain.TestSet{
ProductId: stringUtils.ParseInt(commConsts.ProductId),
WorkspacePath: commConsts.WorkDir,
......@@ -20,6 +20,10 @@ func RunUnitTest(cmdStr string) {
testSet.SubmitResult = true
}
if taskIdOrName != "" {
testSet.Name = taskIdOrName
}
req := serverDomain.WsReq{
Act: commConsts.ExecUnit,
TestSets: []serverDomain.TestSet{testSet},
......
......@@ -32,7 +32,7 @@ func CommitZTFTestResult(files []string, productId int, taskIdOrName string, noN
taskName = taskIdOrName
}
if taskId == 0 && !noNeedConfirm {
if taskId == 0 && taskName == "" && !noNeedConfirm {
taskIdStr := stdinUtils.GetInput("\\d*", "",
i118Utils.Sprintf("pls_enter")+" "+i118Utils.Sprintf("task_id")+
i118Utils.Sprintf("task_id_empty_to_create"))
......@@ -51,6 +51,10 @@ func CommitZTFTestResult(files []string, productId int, taskIdOrName string, noN
return
}
if taskName != "" {
report.Name = taskName
}
config := configHelper.LoadByWorkspacePath(commConsts.ZtfDir)
err = zentaoHelper.CommitResult(report, result.ProductId, result.TaskId, config, nil)
......
......@@ -11,7 +11,7 @@ import (
"path"
)
func RunZTFTest(files []string, moduleIdStr, suiteIdStr, taskIdStr string) error {
func RunZTFTest(files []string, moduleIdStr, suiteIdStr, taskIdOrName string) error {
req := serverDomain.WsReq{
ScriptDirParamFromCmdLine: files[0],
}
......@@ -28,8 +28,8 @@ func RunZTFTest(files []string, moduleIdStr, suiteIdStr, taskIdStr string) error
testSet.SuiteId = stringUtils.ParseInt(suiteIdStr)
req.Act = commConsts.ExecSuite
} else if taskIdStr != "" { // run with task id,
testSet.TaskId = stringUtils.ParseInt(taskIdStr)
} else if taskIdOrName != "" && stringUtils.ParseInt(taskIdOrName) > 0 { // run with task id,
testSet.TaskId = stringUtils.ParseInt(taskIdOrName)
req.Act = commConsts.ExecTask
} else {
......
......@@ -28,7 +28,7 @@ func InitConfig() {
commConsts.WorkDir = fileUtils.GetWorkDir()
commConsts.ZtfDir = fileUtils.GetZTFDir()
if commConsts.Verbose {
if !commConsts.IsRelease {
log.Println("WorkDir=" + commConsts.WorkDir)
log.Println("ZtfDir=" + commConsts.ZtfDir)
}
......
......@@ -10,6 +10,7 @@ type TestExecReq struct {
}
type TestReportSummary struct {
Name string `json:"name"`
No string `json:"no"`
Seq string `json:"seq"`
TestEnv commConsts.OsType `json:"testEnv,omitempty"`
......
......@@ -41,7 +41,9 @@ func (s *TestResultService) Paginate(siteId, productId uint, req serverDomain.Re
for _, workspace := range workspaces {
reportSeqs := analysisHelper.ListReport2(workspace.Path, maxSize)
for _, seq := range reportSeqs {
summary := serverDomain.TestReportSummary{WorkspaceId: int(workspace.ID)}
summary := serverDomain.TestReportSummary{
WorkspaceId: int(workspace.ID),
}
report, _, err1 := analysisHelper.ReadReportByWorkspaceSeq(workspace.Path, seq)
if err1 != nil { // ignore wrong json result
......
......@@ -93,7 +93,10 @@ func IsRelease() bool {
arg1 := strings.ToLower(os.Args[0])
name := filepath.Base(arg1)
return strings.Index(name, "___") != 0 && strings.Index(name, "go-build") != 0
ret := strings.Index(arg1, "go-build") < 0 &&
strings.Index(name, "___") != 0 && strings.Index(name, "go-build") != 0
return ret
}
func GetUserHome() string {
......
......@@ -11,8 +11,8 @@ $>ztf.exe run product01 product01\all.cs 执行all.cs测试套件的
$>ztf.exe run log\001\result.txt 执行result.txt结果文件中的失败用例。
$>ztf.exe run product01 -suite 1 执行禅道系统中编号为1的套件,脚本在product01目录,缩写-s。
$>ztf.exe run -task 1 执行禅道系统中编号为1的任务,脚本在当期目录, 缩写-t。
$>ztf.exe run demo\demo -p 1 -cr -cb 执行目录demo下的脚本,完成后提交结果到禅道,并将失败结果提交成缺陷。
cr提交结果,-cb提交缺陷,-p必填参数指定产品ID
$>ztf.exe run demo\demo -p 1 -t task1 -cr -cb 执行目录demo下的脚本,完成后提交结果到禅道,并将失败结果提交成缺陷。
cr提交结果,-cb提交缺陷; -p必填参数指定产品ID, -t可选参数指定禅道新建测试单名称。
$>ztf.exe run demo\autoit 执行ZTF自带AutoIT脚本。
$>ztf.exe run demo\selenium\chrome.php --interp runtime\php\php7\php.exe
......
......@@ -28,7 +28,14 @@ interface TestResultInfo {
export default function useResultList(): {results: ComputedRef<TestResultInfo[]>, fetchResults: () => void} {
const store = useStore<{ Zentao: ZentaoData, Result: StateType }>();
const results = computed<any[]>(() => store.state.Result.queryResult.result?.map((item) => ({...item, displayName: item.total != 1 ? item.workspaceName + '(' + item.total + ')' : item.testScriptName})));
const results = computed<any[]>(() =>
store.state.Result.queryResult.result?.map((item) => {
const displayName = item.testType === "unit" || item.total != 1 ? item.workspaceName + '(' + item.total + ')' : item.testScriptName
return {
...item,
displayName: displayName
}
}));
const currentProduct = useCurrentProduct();
const pagination = computed<PaginationConfig>(() => store.state.Result.queryResult.pagination);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册