提交 0df2548c 编写于 作者: aaronchen2k2k's avatar aaronchen2k2k

Merge remote-tracking branch 'origin/main'

......@@ -19,6 +19,7 @@ import (
"github.com/sirupsen/logrus"
"os"
"os/signal"
"strings"
"syscall"
)
......@@ -199,14 +200,16 @@ func run(args []string, actionModule *command.IndexModule) {
}
if args[start] == _consts.UnitTestToolMvn {
commConsts.UnitTestTool = _consts.UnitTestToolMvn
commConsts.UnitTestTool = commConsts.JUnit
commConsts.UnitBuildTool = commConsts.Maven
} else if args[start] == _consts.UnitTestToolRobot {
commConsts.UnitTestTool = _consts.UnitTestToolRobot
commConsts.UnitTestTool = commConsts.RobotFramework
commConsts.UnitBuildTool = commConsts.Maven
}
//cmd := strings.Join(args[start:], " ") todo unittest
//
//action.RunUnitTest(cmd)
cmd := strings.Join(args[start:], " ")
action.RunUnitTest(cmd)
} else { // func test
files := fileUtils.GetFilesFromParams(args[2:])
......
......@@ -28,7 +28,8 @@ var (
ServerProjectDir string
UnitTestType string
UnitTestTool string
UnitBuildTool BuildTool
UnitTestTool TestTool
UnitTestResult string
UnitTestResults = "results"
ProductId string
......
......@@ -161,7 +161,6 @@ func GenUnitTestReport(req serverDomain.WsReq, startTime, endTime int64,
resultPath := filepath.Join(commConsts.ExecLogDir, commConsts.ResultText)
msg = " " + i118Utils.Sprintf("run_report", resultPath) + "\n"
sendExecMsg(msg, "false", wsMsg)
if commConsts.ComeFrom != "cmd" {
sendExecMsg(msg, "false", wsMsg)
}
......
......@@ -99,7 +99,9 @@ func RunUnitTest(ch chan int, sendOutputMsg, sendExecMsg func(info, isRunning st
for {
line, err3 := reader1.ReadString('\n')
if line != "" {
sendOutputMsg(line, "", wsMsg)
if commConsts.ComeFrom != "cmd" {
sendOutputMsg(line, "", wsMsg)
}
logUtils.ExecConsole(1, line)
logUtils.ExecFile(line)
......
package action
import (
commConsts "github.com/aaronchen2k/deeptest/internal/comm/consts"
_scriptUtils "github.com/aaronchen2k/deeptest/internal/comm/helper/exec"
stringUtils "github.com/aaronchen2k/deeptest/internal/pkg/lib/string"
serverDomain "github.com/aaronchen2k/deeptest/internal/server/modules/v1/domain"
"github.com/kataras/iris/v12/websocket"
)
func RunUnitTest(cmdStr string) {
req := serverDomain.WsReq{
ProductId: commConsts.ProductId,
ProjectPath: commConsts.WorkDir,
Act: commConsts.ExecUnit,
Cmd: cmdStr,
TestTool: commConsts.UnitTestTool,
BuildTool: commConsts.UnitBuildTool,
}
if stringUtils.ParseInt(req.ProductId) != 0 {
req.SubmitResult = true
}
msg := websocket.Message{}
_scriptUtils.Exec(nil, nil, nil, req, msg)
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册