testStrategies

package
v0.0.0-...-2f3eaab Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2018 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ServiceBasedTesting = "ServiceBased"
	SuiteBasedTesting   = "SuiteBased"
)

ServiceBasedTesting and SuiteBasedTesting are used as boolean to determine and control which strategy to use throughout the test run.

Variables

This section is empty.

Functions

func ExecuteServiceTest

func ExecuteServiceTest(testDefinition *TestDefinition, loadPerUser int, remainder int, configurationSettings *perfTestUtils.Config, mode int) int64

Single execution function for all service test. Runs multiple invocations of the test based on num iterations parameter

func ExecuteTestSuiteWrapper

func ExecuteTestSuiteWrapper(
	testSuite *TestSuite,
	configSettings *perfTestUtils.Config,
	perfStatsForTest *perfTestUtils.PerfStats,
	scenarioTimeStart time.Time,
) map[string][]int64

ExecuteTestSuiteWrapper executes suites using concurrent goroutines and returns response time metrics.

Types

type Header struct {
	Value string `xml:",chardata"`
	Key   string `xml:"key,attr"`
}

Header defines request header key/value pair.

type ResponseValue

type ResponseValue struct {
	Value         string `xml:",chardata"`
	ExtractionKey string `xml:"extractionKey,attr"`
}

ResponseValue encapsulates the variable name (ExtractionKey) and the value from the call response. Used for variable substitution between calls.

type TestCase

type TestCase struct {
	XMLName       xml.Name `xml:"testCase" json:"testCase"`
	Name          string   `xml:",chardata"`
	PreThinkTime  int64    `xml:"preThinkTime,attr" json:"preThinkTime"`
	PostThinkTime int64    `xml:"postThinkTime,attr" json:"postThinkTime"`
	ExecWeight    string   `xml:"execWeight,attr" json:"execWeight"`
}

TestCase is used to encapsulate and marshal a <testCase> tag from the <testSuite> XML file. This data will then be consolidated into the TestSuite/TestDefinition data structure for usage.

type TestDefinition

type TestDefinition struct {
	XMLName             xml.Name             `xml:"testDefinition" json:"testDefinition"`
	TestName            string               `xml:"testName" json:"testName"`
	OverrideHost        string               `xml:"overrideHost" json:"overrideHost"`
	OverridePort        string               `xml:"overridePort" json:"overridePort"`
	HTTPMethod          string               `xml:"httpMethod" json:"httpMethod"`
	Description         string               `xml:"description" json:"description"`
	BaseURI             string               `xml:"baseUri" json:"baseUri"`
	Multipart           bool                 `xml:"multipart" json:"multipart"`
	Payload             string               `xml:"payload" json:"payload"`
	MultipartPayload    []multipartFormField `xml:"multipartPayload>multipartFormField" json:"multipartPayload"`
	ResponseStatusCode  int                  `xml:"responseStatusCode" json:"responseStatusCode"`
	ResponseContentType string               `xml:"responseContentType" json:"responseContentType"`
	Headers             []Header             `xml:"headers>header" json:"headers"`
	ResponseValues      []ResponseValue      `xml:"responseProperties>value" json:"responseValues"`
	PreThinkTime        int64
	PostThinkTime       int64
	ExecWeight          string
}

TestDefinition encapsulates the XML data.

func (*TestDefinition) BuildAndSendRequest

func (testDefinition *TestDefinition) BuildAndSendRequest(
	delay int,
	targetHost string,
	targetPort string,
	uniqueTestRunID string,
) int64

BuildAndSendRequest builds a request from the test definition, performs variable substitutions, sends the request, and returns the response time of the call, or 0 if failure. Note: Response time does not include RequestDelay or ThinkTime.

type TestSuite

type TestSuite struct {
	XMLName         xml.Name   `xml:"testSuite"`
	Name            string     `xml:"name" json:"name"`
	Description     string     `xml:"description" json:"description"`
	TestStrategy    string     `xml:"testStrategy" json:"testStrategy"`
	TestCases       []TestCase `xml:"testCases>testCase" json:"testCases"`
	TestDefinitions []*TestDefinition
}

TestSuite fields get populated from the TestSuiteDefinition after the XML unmarshal is complete. (See TestDefinition above).

func (*TestSuite) BuildTestSuite

func (ts *TestSuite) BuildTestSuite(configurationSettings *perfTestUtils.Config)

BuildTestSuite sets TestStrategy and puts together the test suite accordingly. For ServiceBasedTesting, the test suite is built from test cases in the TestCaseDir, unordered. For SuiteBasedTesting, the test suite is built according to the testCases listed in the test suite definition.

Jump to

Keyboard shortcuts

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