mirror of
https://github.com/httprunner/httprunner.git
synced 2026-06-05 07:49:37 +08:00
feat: set proxy url
This commit is contained in:
@@ -29,15 +29,17 @@ var boomCmd = &cobra.Command{
|
||||
},
|
||||
}
|
||||
|
||||
var masterHost string
|
||||
var masterPort int
|
||||
var maxRPS int64 // TODO: init boomer with this flag
|
||||
var requestIncreaseRate string // TODO: init boomer with this flag
|
||||
var runTasks string // TODO: init boomer with this flag
|
||||
var memoryProfile string
|
||||
var memoryProfileDuration time.Duration
|
||||
var cpuProfile string
|
||||
var cpuProfileDuration time.Duration
|
||||
var (
|
||||
masterHost string
|
||||
masterPort int
|
||||
maxRPS int64 // TODO: init boomer with this flag
|
||||
requestIncreaseRate string // TODO: init boomer with this flag
|
||||
runTasks string // TODO: init boomer with this flag
|
||||
memoryProfile string
|
||||
memoryProfileDuration time.Duration
|
||||
cpuProfile string
|
||||
cpuProfileDuration time.Duration
|
||||
)
|
||||
|
||||
func init() {
|
||||
RootCmd.AddCommand(boomCmd)
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/httprunner/httpboomer"
|
||||
@@ -18,23 +16,26 @@ var runCmd = &cobra.Command{
|
||||
$ httpboomer run examples/ # run testcases in specified folder`,
|
||||
Args: cobra.MinimumNArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
// --silent flag
|
||||
silentFlag, err := cmd.Flags().GetBool("silent")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
log.Printf("[runCmd] set --silent flag: %v", silentFlag)
|
||||
|
||||
var paths []httpboomer.ITestCase
|
||||
for _, arg := range args {
|
||||
paths = append(paths, &httpboomer.TestCasePath{Path: arg})
|
||||
}
|
||||
return httpboomer.NewRunner().SetDebug(!silentFlag).Run(paths...)
|
||||
runner := httpboomer.NewRunner().SetDebug(!silentFlag)
|
||||
if proxyUrl != "" {
|
||||
runner.SetProxyUrl(proxyUrl)
|
||||
}
|
||||
return runner.Run(paths...)
|
||||
},
|
||||
}
|
||||
|
||||
var (
|
||||
silentFlag bool
|
||||
proxyUrl string
|
||||
)
|
||||
|
||||
func init() {
|
||||
RootCmd.AddCommand(runCmd)
|
||||
runCmd.Flags().BoolP("silent", "s", false, "Disable logging request & response details")
|
||||
runCmd.Flags().BoolVarP(&silentFlag, "silent", "s", false, "disable logging request & response details")
|
||||
runCmd.Flags().StringVarP(&proxyUrl, "proxy-url", "p", "", "set proxy url")
|
||||
// runCmd.Flags().BoolP("gen-html-report", "r", false, "Generate HTML report")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user