提交 3ec70565 编写于 作者: aaronchen2k2k's avatar aaronchen2k2k

add helper class

上级 931b2962
......@@ -150,6 +150,7 @@ const (
CppUnit TestTool = "cppunit"
GTest TestTool = "gtest"
QTest TestTool = "qtest"
GoTest TestTool = "gotest"
AutoIt TestTool = "autoit"
Selenium TestTool = "selenium"
......
......@@ -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 {
} else if testTool == commConsts.Allure || testTool == commConsts.GoTest {
resultDir = commConsts.AllureReportDir
zipDir = resultDir
} else {
......
......@@ -3,6 +3,7 @@ package execHelper
import (
"bufio"
"errors"
fileUtils "github.com/easysoft/zentaoatf/pkg/lib/file"
"io"
"os/exec"
"strings"
......@@ -38,6 +39,14 @@ func ExecUnit(ch chan int,
iris.Map{"key": key, "status": "start"}, wsMsg)
}
//deal with -allureReportDir param
arr := strings.Split(req.Cmd, " ")
if len(arr) > 1 && strings.TrimSpace(arr[0]) == "-allureReportDir" {
commConsts.AllureReportDir = arr[1]
fileUtils.RmDir(commConsts.AllureReportDir)
req.Cmd = strings.Join(arr[2:], " ")
}
// run
RunUnitTest(ch, req.Cmd, req.WorkspacePath, wsMsg)
......
......@@ -23,6 +23,8 @@ export const TestTools = [
'CppUnit',
'GTest',
'QTest',
'GoTest',
'Allure',
'RobotFramework',
'Cypress',
......@@ -131,6 +133,16 @@ export const unitTestTypesDef = [
value: 'puppeteer',
cmd: 'ztf puppeteer -p product_id mocha tests/example.js --reporter xunit --reporter-options output=results/testresults.xml -t 30000',
},
{
label: 'GoTest',
value: 'gotest',
cmd: 'ztf allure -p product_id -allureReportDir test/allure-results go test ./test',
},
{
label: 'Allure',
value: 'allure',
cmd: 'ztf allure -p product_id -allureReportDir target/allure-results mvn clean package test -Dtestng.suite=target/classes/testng.xml',
},
]
export const logLevelMap = {
......
......@@ -58,6 +58,8 @@ export const testToolMap = {
cppunit: 'CppUnit',
gtest: 'GTest',
qtest: 'QTest',
goTest: 'GoTest',
allure: 'Allure',
robotframework: 'RobotFramework',
cypress: 'Cypress',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册