mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-30 21:09:36 +08:00
change: make API more concise
This commit is contained in:
@@ -19,7 +19,7 @@ var boomCmd = &cobra.Command{
|
||||
$ hrp boom examples/ # run testcases in specified folder`,
|
||||
Args: cobra.MinimumNArgs(1),
|
||||
PreRun: func(cmd *cobra.Command, args []string) {
|
||||
hrp.SetLogLevel("WARN") // disable info logs for load testing
|
||||
hrp.SetLogger("WARN", logJSON) // disable info logs for load testing
|
||||
},
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
var paths []hrp.ITestCase
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/httprunner/hrp"
|
||||
"github.com/httprunner/hrp/har2case"
|
||||
)
|
||||
|
||||
@@ -37,6 +37,7 @@ var har2caseCmd = &cobra.Command{
|
||||
}
|
||||
outputFiles = append(outputFiles, outputPath)
|
||||
}
|
||||
log := hrp.GetLogger()
|
||||
log.Info().Strs("output", outputFiles).Msg("convert testcase success")
|
||||
return nil
|
||||
},
|
||||
|
||||
@@ -14,16 +14,13 @@ import (
|
||||
var RootCmd = &cobra.Command{
|
||||
Use: "hrp",
|
||||
Short: "One-stop solution for HTTP(S) testing.",
|
||||
Long: `hrp (HttpRunner+) is the next generation for HttpRunner. Enjoy! ✨ 🚀 ✨
|
||||
Long: `hrp (HttpRunner+) is the one-stop solution for HTTP(S) testing. Enjoy! ✨ 🚀 ✨
|
||||
|
||||
License: Apache-2.0
|
||||
Github: https://github.com/httprunner/hrp
|
||||
Copyright 2021 debugtalk`,
|
||||
PersistentPreRun: func(cmd *cobra.Command, args []string) {
|
||||
if !logJSON {
|
||||
hrp.SetLogPretty()
|
||||
}
|
||||
hrp.SetLogLevel(logLevel)
|
||||
hrp.SetLogger(logLevel, logJSON)
|
||||
},
|
||||
Version: version.VERSION,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user