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

test and fix on win7

上级 50097e26
......@@ -109,7 +109,9 @@ func DealwithTestCase(tc model.TestCase, langType string, singleFile bool, caseP
utils.WriteFile(expectFile, strings.Join(expects, "\n"))
}
template := utils.ReadFile("xdoc/template/" + langType + ".tpl")
template := utils.ReadFile(
fmt.Sprintf("xdoc%stemplate%s", string(os.PathSeparator), string(os.PathSeparator)) +
langType + ".tpl")
content := fmt.Sprintf(template,
caseId, caseTitle,
strings.Join(steps, "\n"), expectsTxt,
......
......@@ -30,11 +30,11 @@ func main() {
preferenceSet := flag.NewFlagSet("atf set/reset - Set preferences", flag.ContinueOnError)
flagSets = append(flagSets, *preferenceSet)
preferenceSet.StringVar(&language, "l", "", "tool language, en or zh")
preferenceSet.StringVar(&workDir, "d", "./", "work dir")
preferenceSet.StringVar(&workDir, "d", ".", "work dir")
runSet := flag.NewFlagSet("atf run - Run test scripts in specified folder", flag.ContinueOnError)
flagSets = append(flagSets, *runSet)
runSet.StringVar(&scriptDir, "d", "./", "Directory that contains test scripts")
runSet.StringVar(&scriptDir, "d", ".", "Directory that contains test scripts")
runSet.StringVar(&langType, "l", "", "Script Language like python, php etc.")
runSet.Var(&files, "f", "Script files to run, no need langType if specified")
......@@ -52,12 +52,12 @@ func main() {
listSet := flag.NewFlagSet("atf list - List test scripts", flag.ContinueOnError)
flagSets = append(flagSets, *listSet)
listSet.StringVar(&scriptDir, "d", "./", "Directory that contains test scripts")
listSet.StringVar(&scriptDir, "d", ".", "Directory that contains test scripts")
listSet.StringVar(&langType, "l", "", "Script Language like python, php etc.")
viewSet := flag.NewFlagSet("atf view - View test scripts", flag.ContinueOnError)
flagSets = append(flagSets, *viewSet)
viewSet.StringVar(&scriptDir, "d", "./", "Directory that contains test scripts")
viewSet.StringVar(&scriptDir, "d", ".", "Directory that contains test scripts")
viewSet.StringVar(&langType, "l", "", "Script Language like python, php etc.")
viewSet.Var(&files, "f", "Script files to view, no need langType if specified")
......
......@@ -4,6 +4,7 @@ import (
"fmt"
"github.com/easysoft/zentaoatf/src/utils"
"io/ioutil"
"os"
"path"
"regexp"
"strings"
......@@ -34,7 +35,7 @@ func LoadTestResults(assert string) []string {
func GetTestResult(assert string, date string) []string {
mode, name := GetRunModeAndName(assert)
resultPath := utils.Prefer.WorkDir + utils.LogDir + logFolder(mode, name, date) + "/result.txt"
resultPath := utils.Prefer.WorkDir + utils.LogDir + logFolder(mode, name, date) + string(os.PathSeparator) + "result.txt"
arr := make([]string, 0)
content := utils.ReadFile(resultPath)
......@@ -57,7 +58,7 @@ func GetTestResult(assert string, date string) []string {
func GetCheckpointsResult(assert string, date string, caseLine string) string {
mode, name := GetRunModeAndName(assert)
resultPath := utils.Prefer.WorkDir + utils.LogDir + logFolder(mode, name, date) + "/result.txt"
resultPath := utils.Prefer.WorkDir + utils.LogDir + logFolder(mode, name, date) + string(os.PathSeparator) + "result.txt"
content := utils.ReadFile(resultPath)
......@@ -91,7 +92,7 @@ func GetLogFileByCase(assert string, date string, file string) string {
ext := path.Ext(file)
logName := strings.Replace(path.Base(file), ext, ".log", -1)
return utils.Prefer.WorkDir + utils.LogDir + logFolder(mode, name, date) + "/" + logName
return utils.Prefer.WorkDir + utils.LogDir + logFolder(mode, name, date) + string(os.PathSeparator) + logName
}
func logFolder(mode string, name string, date string) string {
......
......@@ -6,7 +6,7 @@ import (
)
func main() {
a := path.Base("ss/1.txt")
a := path.Ext("ss/1.txt")
fmt.Println(a)
}
......@@ -62,7 +62,7 @@ func getInst() model.Preference {
yaml.Unmarshal(buf, &Prefer)
} else { // init
Prefer.Language = "en"
Prefer.WorkDir = convertWorkDir("./")
Prefer.WorkDir = convertWorkDir(".")
history := model.WorkHistory{Id: uuid.NewV4().String(), ProjectPath: Prefer.WorkDir}
Prefer.WorkHistories = []model.WorkHistory{history}
......@@ -98,7 +98,7 @@ func PrintPreferenceToView() {
}
func convertWorkDir(path string) string {
if path == "./" || path == "." {
if path == "." {
path, _ = filepath.Abs(`.`)
path = path + string(os.PathSeparator)
} else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册