Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Cmd = &cobra.Command{ Use: "run", Short: "Run Tests", PreRun: func(cmd *cobra.Command, args []string) { if len(args) == 0 { path = append(path, ".") } else { path = args[0:] } venom.RegisterExecutor(exec.Name, exec.New()) venom.RegisterExecutor(http.Name, http.New()) venom.RegisterExecutor(imap.Name, imap.New()) venom.RegisterExecutor(readfile.Name, readfile.New()) venom.RegisterExecutor(smtp.Name, smtp.New()) venom.RegisterExecutor(ssh.Name, ssh.New()) venom.RegisterExecutor(web.Name, web.New()) venom.RegisterExecutor(ovhapi.Name, ovhapi.New()) venom.RegisterTestCaseContext(defaultctx.Name, defaultctx.New()) venom.RegisterTestCaseContext(webctx.Name, webctx.New()) }, Run: func(cmd *cobra.Command, args []string) { if parallel < 0 { parallel = 1 } mapvars := make(map[string]string) if withEnv { variables = append(variables, os.Environ()...) } for _, a := range variables { t := strings.SplitN(a, "=", 2) if len(t) < 2 { continue } mapvars[t[0]] = strings.Join(t[1:], "") } if varFile != "" { varFileMap := make(map[string]string) bytes, err := ioutil.ReadFile(varFile) if err != nil { log.Fatal(err) } switch filepath.Ext(varFile) { case ".json": err = json.Unmarshal(bytes, &varFileMap) case ".yaml": err = yaml.Unmarshal(bytes, &varFileMap) default: log.Fatal("unsupported varFile format") } if err != nil { log.Fatal(err) } for key, value := range varFileMap { mapvars[key] = value } } start := time.Now() tests, err := venom.Process(path, mapvars, exclude, parallel, logLevel, detailsLevel, os.Stdout) if err != nil { log.Fatal(err) } elapsed := time.Since(start) if err := venom.OutputResult(format, resume, resumeFailures, outputDir, *tests, elapsed, detailsLevel); err != nil { fmt.Fprintf(os.Stderr, err.Error()) os.Exit(1) } }, }
Cmd run
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.