newman

package
v1.16.11 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2023 License: MIT, MIT Imports: 22 Imported by: 0

Documentation

Overview

struct autogenerated from output file some fields could be missing example command newman run jw1.postman_collection.json --reporters cli,json --reporter-json-export outputfile.json

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MapMetadataToResult

func MapMetadataToResult(newmanResult NewmanExecutionResult) testkube.ExecutionResult

func NewEnvFileReader

func NewEnvFileReader(m map[string]testkube.Variable, paramsFile string, secretEnvs map[string]string) (io.Reader, error)

Types

type Assertion

type Assertion struct {
	Assertion string    `json:"assertion"`
	Skipped   bool      `json:"skipped"`
	Error     *RunError `json:"error,omitempty"`
}

type Collection

type Collection struct {
	Metadata struct {
		PostmanID string `json:"postman_id"`
	} `json:"_"`
	Item     []Item        `json:"item"`
	Event    []interface{} `json:"event"`
	Variable []interface{} `json:"variable"`
	Info     Info          `json:"info"`
}

type EnvFile

type EnvFile struct {
	ID                   string    `json:"id"`
	Name                 string    `json:"name"`
	Values               []Value   `json:"values"`
	PostmanVariableScope string    `json:"_postman_variable_scope"`
	PostmanExportedAt    time.Time `json:"_postman_exported_at"`
	PostmanExportedUsing string    `json:"_postman_exported_using"`
}

func NewEnvFileFromSecretVariablesMap added in v1.11.31

func NewEnvFileFromSecretVariablesMap(m map[string]testkube.Variable) (envFile EnvFile)

func NewEnvFileFromString

func NewEnvFileFromString(f string) (envFile EnvFile, err error)

func NewEnvFileFromVariablesMap

func NewEnvFileFromVariablesMap(m map[string]testkube.Variable) (envFile EnvFile)

func (*EnvFile) PrependParams

func (e *EnvFile) PrependParams(from EnvFile)

Prepend params adds Values from EnvFile on the beginning of array

type Environment

type Environment struct {
	ID     string        `json:"id"`
	Values []interface{} `json:"values"`
}

type Event

type Event struct {
	Listen string `json:"listen"`
	Script struct {
		ID              string   `json:"id"`
		Type            string   `json:"type"`
		Exec            []string `json:"exec"`
		LastExecutionID string   `json:"_lastExecutionId"`
	} `json:"script"`
}

type Execution

type Execution struct {
	Cursor     ExecutionCursor `json:"cursor,omitempty"`
	Item       Item            `json:"item"`
	Request    Request         `json:"request"`
	Response   Response        `json:"response"`
	ID         string          `json:"id"`
	Assertions []Assertion     `json:"assertions"`
}

type ExecutionCursor

type ExecutionCursor struct {
	Position      int    `json:"position"`
	Iteration     int    `json:"iteration"`
	Length        int    `json:"length"`
	Cycles        int    `json:"cycles"`
	Empty         bool   `json:"empty"`
	EOF           bool   `json:"eof"`
	Bof           bool   `json:"bof"`
	Cr            bool   `json:"cr"`
	Ref           string `json:"ref"`
	HTTPRequestID string `json:"httpRequestId"`
}

type ExecutionJSONResult

type ExecutionJSONResult struct {
	Collection  Collection  `json:"collection"`
	Environment Environment `json:"environment"`
	Globals     Globals     `json:"globals"`
	Run         Run         `json:"run"`
}

type Failure

type Failure struct {
	Error  FailureError `json:"error"`
	At     string       `json:"at"`
	Source struct {
		ID      string `json:"id"`
		Name    string `json:"name"`
		Request struct {
			URL struct {
				Protocol string        `json:"protocol"`
				Path     []string      `json:"path"`
				Host     []string      `json:"host"`
				Query    []interface{} `json:"query"`
				Variable []interface{} `json:"variable"`
			} `json:"url"`
			Method string `json:"method"`
		} `json:"request"`
		Response []interface{} `json:"response"`
		Event    []struct {
			Listen string `json:"listen"`
			Script struct {
				ID              string   `json:"id"`
				Type            string   `json:"type"`
				Exec            []string `json:"exec"`
				LastExecutionID string   `json:"_lastExecutionId"`
			} `json:"script"`
		} `json:"event"`
	} `json:"source"`
	Parent struct {
		Metadata struct {
			PostmanID string `json:"postman_id"`
		} `json:"_"`
		Item []struct {
			ID      string `json:"id"`
			Name    string `json:"name"`
			Request struct {
				URL struct {
					Protocol string        `json:"protocol"`
					Path     []string      `json:"path"`
					Host     []string      `json:"host"`
					Query    []interface{} `json:"query"`
					Variable []interface{} `json:"variable"`
				} `json:"url"`
				Method string `json:"method"`
			} `json:"request"`
			Response []interface{} `json:"response"`
			Event    []struct {
				Listen string `json:"listen"`
				Script struct {
					ID              string   `json:"id"`
					Type            string   `json:"type"`
					Exec            []string `json:"exec"`
					LastExecutionID string   `json:"_lastExecutionId"`
				} `json:"script"`
			} `json:"event"`
		} `json:"item"`
		Event    []interface{} `json:"event"`
		Variable []interface{} `json:"variable"`
		Info     struct {
			PostmanID string `json:"_postman_id"`
			Name      string `json:"name"`
			Schema    string `json:"schema"`
		} `json:"info"`
	} `json:"parent"`
	Cursor struct {
		Position      int    `json:"position"`
		Iteration     int    `json:"iteration"`
		Length        int    `json:"length"`
		Cycles        int    `json:"cycles"`
		Empty         bool   `json:"empty"`
		EOF           bool   `json:"eof"`
		Bof           bool   `json:"bof"`
		Cr            bool   `json:"cr"`
		Ref           string `json:"ref"`
		HTTPRequestID string `json:"httpRequestId"`
		ScriptID      string `json:"scriptId"`
		Execution     string `json:"execution"`
	} `json:"cursor"`
}

type FailureError

type FailureError struct {
	Name       string `json:"name"`
	Index      int    `json:"index"`
	Test       string `json:"test"`
	Message    string `json:"message"`
	Stack      string `json:"stack"`
	Checksum   string `json:"checksum"`
	ID         string `json:"id"`
	Timestamp  int64  `json:"timestamp"`
	Stacktrace []struct {
		FileName     string `json:"fileName"`
		LineNumber   int    `json:"lineNumber"`
		FunctionName string `json:"functionName"`
		TypeName     string `json:"typeName"`
		MethodName   string `json:"methodName"`
		ColumnNumber int    `json:"columnNumber"`
		Native       bool   `json:"native"`
	} `json:"stacktrace"`
}

type Globals

type Globals struct {
	ID     string        `json:"id"`
	Values []interface{} `json:"values"`
}

type Info

type Info struct {
	PostmanID string `json:"_postman_id"`
	Name      string `json:"name"`
	Schema    string `json:"schema"`
}

type Item

type Item struct {
	ID       string        `json:"id"`
	Name     string        `json:"name"`
	Request  Request       `json:"request"`
	Response []interface{} `json:"response"`
	Event    []Event       `json:"event"`
}

type NewmanExecutionResult

type NewmanExecutionResult struct {
	Output   string
	Metadata ExecutionJSONResult
}

type NewmanRunner

type NewmanRunner struct {
	Params  envs.Params
	Scraper scraper.Scraper
}

NewmanRunner struct for newman based runner

func NewNewmanRunner

func NewNewmanRunner(ctx context.Context, params envs.Params) (*NewmanRunner, error)

func (*NewmanRunner) GetNewmanResult

func (r *NewmanRunner) GetNewmanResult(tmpName string, out []byte) (newmanResult NewmanExecutionResult, err error)

func (NewmanRunner) GetType

func (r NewmanRunner) GetType() runner.Type

GetType returns runner type

func (*NewmanRunner) Run

func (r *NewmanRunner) Run(ctx context.Context, execution testkube.Execution) (result testkube.ExecutionResult, err error)

Run runs particular test content on top of newman binary

type Request

type Request struct {
	URL struct {
		Protocol string        `json:"protocol"`
		Path     []string      `json:"path"`
		Host     []string      `json:"host"`
		Query    []interface{} `json:"query"`
		Variable []interface{} `json:"variable"`
	} `json:"url"`
	Header []struct {
		Key    string `json:"key"`
		Value  string `json:"value"`
		System bool   `json:"system"`
	} `json:"header"`
	Method string `json:"method"`
}

type Response

type Response struct {
	ID     string `json:"id"`
	Status string `json:"status"`
	Code   int    `json:"code"`
	Header []struct {
		Key   string `json:"key"`
		Value string `json:"value"`
	} `json:"header"`
	Stream struct {
		Type string `json:"type"`
		Data []int  `json:"data"`
	} `json:"stream"`
	Cookie       []interface{} `json:"cookie"`
	ResponseTime int           `json:"responseTime"`
	ResponseSize int           `json:"responseSize"`
}

type Run

type Run struct {
	Stats      RunStats    `json:"stats"`
	Timings    RunTimings  `json:"timings"`
	Executions []Execution `json:"executions"`
	Transfers  struct {
		ResponseTotal int `json:"responseTotal"`
	} `json:"transfers"`
	Failures []Failure `json:"failures"`
	Error    *RunError `json:"error,omitempty"`
}

type RunError

type RunError struct {
	Name    string `json:"name"`
	Index   int    `json:"index"`
	Test    string `json:"test"`
	Message string `json:"message"`
	Stack   string `json:"stack"`
}

type RunStats

type RunStats struct {
	Iterations        Stat `json:"iterations"`
	Items             Stat `json:"items"`
	Scripts           Stat `json:"scripts"`
	Prerequests       Stat `json:"prerequests"`
	Requests          Stat `json:"requests"`
	Tests             Stat `json:"tests"`
	Assertions        Stat `json:"assertions"`
	TestScripts       Stat `json:"testScripts"`
	PrerequestScripts Stat `json:"prerequestScripts"`
}

type RunTimings

type RunTimings struct {
	ResponseAverage  float64 `json:"responseAverage"`
	ResponseMin      int     `json:"responseMin"`
	ResponseMax      int     `json:"responseMax"`
	ResponseSd       float64 `json:"responseSd"`
	DNSAverage       int     `json:"dnsAverage"`
	DNSMin           int     `json:"dnsMin"`
	DNSMax           int     `json:"dnsMax"`
	DNSSd            int     `json:"dnsSd"`
	FirstByteAverage int     `json:"firstByteAverage"`
	FirstByteMin     int     `json:"firstByteMin"`
	FirstByteMax     int     `json:"firstByteMax"`
	FirstByteSd      int     `json:"firstByteSd"`
	Started          int64   `json:"started"`
	Completed        int64   `json:"completed"`
}

type Stat

type Stat struct {
	Total   int `json:"total"`
	Pending int `json:"pending"`
	Failed  int `json:"failed"`
}

type Value

type Value struct {
	Key     string `json:"key"`
	Value   string `json:"value"`
	Enabled bool   `json:"enabled"`
}

Jump to

Keyboard shortcuts

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