run

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 3, 2017 License: BSD-3-Clause Imports: 16 Imported by: 0

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.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.Split(a, "=")
			if len(t) < 2 {
				continue
			}
			mapvars[t[0]] = strings.Join(t[1:], "")
		}

		start := time.Now()
		tests, err := venom.Process(path, mapvars, exclude, parallel, logLevel, detailsLevel)
		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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL