提交 78ee032f 编写于 作者: aaronchen2k2k's avatar aaronchen2k2k

go test and allure support

上级 01321c3c
......@@ -198,7 +198,7 @@ func RetrieveUnitResult(workspacePath string, startTime int64, testTool commCons
testTool == commConsts.Playwright || testTool == commConsts.Puppeteer {
resultDir = "results"
zipDir = resultDir
} else if testTool == commConsts.Allure || testTool == commConsts.GoTest {
} else if isAllureReport(testTool) {
resultDir = commConsts.AllureReportDir
zipDir = resultDir
} else {
......@@ -212,7 +212,7 @@ func RetrieveUnitResult(workspacePath string, startTime int64, testTool commCons
resultFiles, _ = GetSuiteFiles(resultDir, startTime, testTool)
}
if testTool == commConsts.Allure {
if isAllureReport(testTool) {
if resultDir != "" {
suites = GetAllureSuites(resultDir, startTime)
} else {
......@@ -274,7 +274,7 @@ func GetSuiteFiles(resultDir string, startTime int64, testTool commConsts.TestTo
continue
}
if (testTool == commConsts.Allure && ext == ".json") || ext == ".xml" {
if (isAllureReport(testTool) && ext == ".json") || ext == ".xml" {
pth := filepath.Join(resultDir, name)
resultFiles = append(resultFiles, pth)
}
......@@ -780,3 +780,7 @@ func ConvertCyResult(result commDomain.CypressTestsuites) commDomain.UnitTestSui
return testSuite
}
func isAllureReport(testTool commConsts.TestTool) (ret bool) {
return testTool == commConsts.Allure || testTool == commConsts.GoTest
}
......@@ -6,6 +6,7 @@ import (
fileUtils "github.com/easysoft/zentaoatf/pkg/lib/file"
"io"
"os/exec"
"path/filepath"
"strings"
"time"
......@@ -43,7 +44,8 @@ func ExecUnit(ch chan int,
arr := strings.Split(req.Cmd, " ")
if len(arr) > 1 && strings.TrimSpace(arr[0]) == "-allureReportDir" {
commConsts.AllureReportDir = arr[1]
fileUtils.RmDir(commConsts.AllureReportDir)
pth := filepath.Join(req.WorkspacePath, commConsts.AllureReportDir)
fileUtils.RmDir(pth)
req.Cmd = strings.Join(arr[2:], " ")
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册