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

add helper class

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