提交 2be80253 编写于 作者: aaronchen2k2k's avatar aaronchen2k2k

add productId in command param and http request

上级 3f3ca0d2
......@@ -7,9 +7,11 @@ import (
configUtils "github.com/easysoft/zentaoatf/src/utils/config"
i118Utils "github.com/easysoft/zentaoatf/src/utils/i118"
logUtils "github.com/easysoft/zentaoatf/src/utils/log"
"github.com/easysoft/zentaoatf/src/utils/vari"
"github.com/easysoft/zentaoatf/src/utils/zentao"
"github.com/fatih/color"
"os"
"strconv"
)
func CommitTestResult(report model.TestReport, testTaskId int) {
......@@ -18,6 +20,7 @@ func CommitTestResult(report model.TestReport, testTaskId int) {
report.ZentaoData = os.Getenv("ZENTAO_DATA")
report.BuildUrl = os.Getenv("BUILD_URL")
report.ProductId, _ = strconv.Atoi(vari.ProductId)
report.TaskId = testTaskId
if len(report.ZTFResults) > 0 {
......
......@@ -18,6 +18,7 @@ var (
UnitTestType string
UnitTestTool string
UnitTestResult string
ProductId string
SessionVar string
SessionId string
......
......@@ -158,18 +158,29 @@ func main() {
func run(args []string) {
if len(args) >= 3 && stringUtils.FindInArr(args[2], constant.UnitTestType) { // unit test
// junit -p 1 mvn clean package test
vari.UnitTestType = args[2]
if args[3] == "mvn" {
vari.UnitTestTool = "mvn"
} else {
flagSet.Parse(args[3:])
}
flagSet.Parse(args[3:8])
start := 3
if vari.UnitTestResult != "" {
start = start + 2
} else {
vari.UnitTestResult = "./"
}
if productId != "" {
start = start + 2
vari.ProductId = productId
}
if vari.Verbose {
start = start + 1
}
if args[start] == "mvn" {
vari.UnitTestTool = "mvn"
}
cmd := strings.Join(args[start:], " ")
action.RunUnitTest(cmd)
} else { // func test
......@@ -177,6 +188,8 @@ func run(args []string) {
err := flagSet.Parse(args[len(files)+2:])
if err == nil {
vari.ProductId = productId
if len(files) == 0 {
files = append(files, ".")
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册