support using curl as subcommand

This commit is contained in:
buyuxiang
2022-07-06 13:46:12 +08:00
parent 100c22b81f
commit f4aa4ffb28
8 changed files with 347 additions and 210 deletions

View File

@@ -26,27 +26,7 @@ var runCmd = &cobra.Command{
path := hrp.TestCasePath(arg)
paths = append(paths, &path)
}
runner := hrp.NewRunner(nil).
SetFailfast(!continueOnFailure).
SetSaveTests(saveTests)
if genHTMLReport {
runner.GenHTMLReport()
}
if !requestsLogOff {
runner.SetRequestsLogOn()
}
if httpStatOn {
runner.SetHTTPStatOn()
}
if pluginLogOn {
runner.SetPluginLogOn()
}
if venv != "" {
runner.SetPython3Venv(venv)
}
if proxyUrl != "" {
runner.SetProxyUrl(proxyUrl)
}
runner := makeHRPRunner()
err := runner.Run(paths...)
if err != nil {
os.Exit(1)
@@ -74,3 +54,28 @@ func init() {
runCmd.Flags().BoolVarP(&saveTests, "save-tests", "s", false, "save tests summary")
runCmd.Flags().BoolVarP(&genHTMLReport, "gen-html-report", "g", false, "generate html report")
}
func makeHRPRunner() *hrp.HRPRunner {
runner := hrp.NewRunner(nil).
SetFailfast(!continueOnFailure).
SetSaveTests(saveTests)
if genHTMLReport {
runner.GenHTMLReport()
}
if !requestsLogOff {
runner.SetRequestsLogOn()
}
if httpStatOn {
runner.SetHTTPStatOn()
}
if pluginLogOn {
runner.SetPluginLogOn()
}
if venv != "" {
runner.SetPython3Venv(venv)
}
if proxyUrl != "" {
runner.SetProxyUrl(proxyUrl)
}
return runner
}