diff --git a/src/biz/check.go b/src/biz/check.go index 56180b7a6f1f5d47befd8059307d25335bee3de0..a0ed2ff12e7379125908e0dfc0c3571238014cf7 100644 --- a/src/biz/check.go +++ b/src/biz/check.go @@ -33,8 +33,6 @@ func ValidateTestCase(scriptFile string, langType string, indx := 0 for _, step := range stepArr { - stepResult := true - var expectLines []string if len(expectArr) > indx { expectLines = expectArr[indx] @@ -45,26 +43,7 @@ func ValidateTestCase(scriptFile string, langType string, actualLines = actualArr[indx] } - checkpointLogs := make([]model.CheckPointLog, 0) - - indx2 := 0 - for _, expect := range expectLines { - log := "N/A" - if len(actualLines) > indx2 { - log = actualLines[indx2] - } - - pass := MatchString(expect, log, langType) - if !pass { - stepResult = false - } - - cp := model.CheckPointLog{Numb: indx2 + 1, Status: pass, Expect: expect, Actual: log} - checkpointLogs = append(checkpointLogs, cp) - - indx2++ - } - + stepResult, checkpointLogs := ValidateStep(langType, expectLines, actualLines) step := model.StepLog{Numb: indx + 1, Name: step, Status: stepResult, CheckPoints: checkpointLogs} stepLogs = append(stepLogs, step) @@ -82,6 +61,34 @@ func ValidateTestCase(scriptFile string, langType string, report.Cases = append(report.Cases, cs) } +func ValidateStep(langType string, expectLines []string, actualLines []string) (bool, []model.CheckPointLog) { + + stepResult := true + + checkpointLogs := make([]model.CheckPointLog, 0) + + indx2 := 0 + for _, expect := range expectLines { + log := "N/A" + if len(actualLines) > indx2 { + log = actualLines[indx2] + } + + pass := MatchString(expect, log, langType) + if !pass { + stepResult = false + } + + cp := model.CheckPointLog{Numb: indx2 + 1, Status: pass, Expect: expect, Actual: log} + checkpointLogs = append(checkpointLogs, cp) + + indx2++ + } + + return stepResult, checkpointLogs + +} + func Print(report model.TestReport, workDir string) { startSec := time.Unix(report.StartTime, 0) endSec := time.Unix(report.EndTime, 0) @@ -125,7 +132,7 @@ func Print(report model.TestReport, workDir string) { count++ } } else { - PrintAndLog(&logs, " No checkpoints") + PrintAndLog(&logs, " No check points") } } diff --git a/xdoc/scripts/tc-100.php b/xdoc/scripts/tc-100.php new file mode 100644 index 0000000000000000000000000000000000000000..53851c8d11bbacbc320d818545874d9da277f138 --- /dev/null +++ b/xdoc/scripts/tc-100.php @@ -0,0 +1,23 @@ + + +TC; + +// 此处编写操作步骤代码 + +echo "#\n"; // 验证点@step1020的标记位,请勿删除 +// 期待结果:用户成功登录 +// 此处编写上述验证点代码,输出实际结果, 可以有多行 + + +?> diff --git a/xdoc/scripts/tc-200.php b/xdoc/scripts/tc-200.php new file mode 100644 index 0000000000000000000000000000000000000000..f8b4f2ea7fc1bbc4791068fdf2c307c9d43a8469 --- /dev/null +++ b/xdoc/scripts/tc-200.php @@ -0,0 +1,35 @@ + diff --git a/xdoc/scripts/tc-300.php b/xdoc/scripts/tc-300.php new file mode 100644 index 0000000000000000000000000000000000000000..642c7fff422d298ab4e15550450280d624b794eb --- /dev/null +++ b/xdoc/scripts/tc-300.php @@ -0,0 +1,17 @@ + diff --git a/xdoc/scripts/tc-400.php b/xdoc/scripts/tc-400.php new file mode 100644 index 0000000000000000000000000000000000000000..401f413f593b4c9767800f1f77cc36402b7663a6 --- /dev/null +++ b/xdoc/scripts/tc-400.php @@ -0,0 +1,17 @@ +