runscope

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2020 License: MPL-2.0 Imports: 14 Imported by: 0

README

Build Status

go-runscope

go-runscope is a go client library for the runscope api

Installation

go get github.com/ewilde/go-runscope

Usage

package main

import (
    "fmt"
    "github.com/ewilde/go-runscope"
)

func createBucket() {
    var accessToken = "{your token}"  // See https://www.runscope.com/applications
    var teamUUID = "{your team uuid}" // See https://www.runscope.com/teams
    var client = runscope.NewClient(runscope.APIURL, accessToken)
    var bucket = &runscope.Bucket{
        Name: "My first bucket",
        Team: &runscope.Team{
            ID: teamUUID,
        },
    }

    bucket, err := client.CreateBucket(bucket)
    if err != nil {
        log.Printf("[ERROR] error creating bucket: %s", err)
    }
}
All Resources and Actions

Complete examples can be found in the examples folder or in the unit tests

Bucket
Client.CreateBucket(bucket *Bucket) (*Bucket, error)
...
    var bucket = &runscope.Bucket{
        Name: "My first bucket",
        Team: &runscope.Team{
            ID: teamUUID,
        },
    }
	bucket, err := client.CreateBucket(&{Bucket{Name: "test", Team}})
Client.ReadBucket(key string) (*Bucket, error)
...
    bucket, err := client.ReadBucket("htqee6p4dhvc")
    if err != nil {
        log.Printf("[ERROR] error creating bucket: %s", err)
    }

    fmt.Printf("Bucket read successfully: %s", bucket.String())
Client.DeleteBucket(key string)
...
    err := client.DeleteBucket("htqee6p4dhvc")
    if err != nil {
        log.Printf("[ERROR] error creating bucket: %s", err)
    }
Environment
Client.CreateSharedEnvironment(environment *Environment, bucket *Bucket) (*Environment, error)
...
environment := &runscope.Environment{
		Name: "tf_environment",
		InitialVariables: map[string]string{
			"VarA" : "ValB",
			"VarB" : "ValB",
		},
		Integrations: []*runscope.Integration {
			{
				ID:              "27e48b0d-ba8e-4fe0-bcaa-dd9de08dc47d",
				IntegrationType: "pagerduty",
			},
			{
				ID:              "574f4560-0f50-41da-a2f7-bdce419ad378",
				IntegrationType: "slack",
			},
		},
	}

environment, err := client.CreateSharedEnvironment(environment, createBucket())
if err != nil {
    log.Printf("[ERROR] error creating environment: %s", err)
}
Client.ReadSharedEnvironment(environment *Environment, bucket *Bucket) (*Environment, error)

Client.ReadTestEnvironment(environment *Environment, test *Test) (*Environment, error)

Client.UpdateSharedEnvironment(environment *Environment, bucket *Bucket) (*Environment, error)

Client.UpdateTestEnvironment(environment *Environment, test *Test) (*Environment, error)
Test
Client.CreateTest(test *Test) (*Test, error) (*Environment, error)
...
    test := &Test{ Name: "tf_test", Description: "This is a tf new test", Bucket: bucket }
	test, err = client.CreateTest(newTest)
	defer client.DeleteTest(newTest)

	if err != nil {
		t.Error(err)
	}

Client.ReadTest(test *Test) (*Test, error)

Client.UpdateTest(test *Test) (*Test, error)

Client.DeleteTest(test *Test) error
Test step
Client.CreateTestStep(testStep *TestStep, bucketKey string, testID string) (*TestStep, error)
...
    step := NewTestStep()
    step.StepType = "request"
    step.URL = "http://example.com"
    step.Method = "GET"
    step.Assertions = [] Assertion {{
        Source: "response_status",
        Comparison : "equal_number",
        Value: 200,
    }}

    step, err = client.CreateTestStep(step, bucket.Key, test.ID)
    if err != nil {
        t.Error(err)
    }

Client.ReadTestStep(testStep *TestStep, bucketKey string, testID string) (*TestStep, error)

Client.UpdateTestStep(testStep *TestStep, bucketKey string, testID string) (*TestStep, error)

Client.DeleteTestStep(testStep *TestStep, bucketKey string, testID string) error
Schedule
Client.CreateSchedule(schedule *Schedule, bucketKey string, testID string) (*Schedule, error)
...
    schedule := NewSchedule()
    schedule.Note = "Daily schedule"
    schedule.Interval = "1d"
    schedule.EnvironmentID = environment.ID

    schedule, err = client.CreateSchedule(schedule, bucket.Key, test.ID)
    if err != nil {
        t.Error(err)
    }

Client.ReadSchedule(schedule *Schedule, bucketKey string, testID string) (*Schedule, error)

Client.UpdateSchedule(schedule *Schedule, bucketKey string, testID string) (*Schedule, error)

Client.DeleteSchedule(schedule *Schedule, bucketKey string, testID string) error
Unit Testing

You can now mock client data:

type MockClient struct {
}

func (client *MockClient) ListBuckets() ([]*runscope.Bucket, error) {
 	bucket1 := &runscope.Bucket{}
 	bucket2 := &runscope.Bucket{}
 	bucket1.Name = "MyBucket"
 	bucket2.Name = "MyNonExistingBucket"
 	return []*runscope.Bucket{bucket1, bucket2}, nil
 }

Then you can use this mockClient in your Unit Test:

func TestReadBucket(t *testing.T) {
	t.Run("Successful return bucket", func(t *testing.T) {
		client := &resources.MockClient{}
		getBucket := ReadBucket("MyBucket", client)

		if getBucket == nil {
			t.Error("Should have returned a bucket")
		}
	})
}

Developing

Running the tests

By default the tests requiring access to the runscope api (most of them) will be skipped. To run the integration tests please set the following environment variables.

Note: you will need at least one integration setup on your account, i.e. slack

RUNSCOPE_ACC=true
RUNSCOPE_ACCESS_TOKEN={your access token}
RUNSCOPE_TEAM_ID={your team uuid}

Access tokens can be created using the applications section of your runscope account.

Your team url can be found by taking the uuid from https://www.runscope.com/teams

Contributing

  1. Fork it ( https://github.com/ewilde/go-runscope/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Make sure that make build passes with test running
  4. Commit your changes (git commit -am 'Add some feature')
  5. Push to the branch (git push origin my-new-feature)
  6. Create a new Pull Request

Documentation

Overview

Package runscope implements a client library for the runscope api (https://www.runscope.com/docs/api)

Index

Constants

View Source
const APIURL = "https://api.runscope.com"

APIURL is the default runscope api uri

View Source
const (
	// DefaultPageSize is the max number of items fetched in each request
	DefaultPageSize = 10
)

Variables

This section is empty.

Functions

func DebugF

func DebugF(level int, format string, args ...interface{})

func ErrorF

func ErrorF(level int, format string, args ...interface{})

func InfoF

func InfoF(level int, format string, args ...interface{})

func RegisterLogHandlers

func RegisterLogHandlers(
	debug func(level int, format string, args ...interface{}),
	info func(level int, format string, args ...interface{}),
	error func(level int, format string, args ...interface{}))

Types

type Assertion

type Assertion struct {
	Comparison string      `json:"comparison,omitempty"`
	Value      interface{} `json:"value,omitempty"`
	Source     string      `json:"source,omitempty"`
	Property   string      `json:"property,omitempty"`
}

Assertion allow you to specify success criteria for a given request, Ghost Inspector, subtest, or condition step. Each assertion is defined by a source, property, comparison, and value. See https://www.runscope.com/docs/api/steps#assertions

type Bucket

type Bucket struct {
	Name           string `json:"name,omitempty"`
	Key            string `json:"key,omitempty"`
	Default        bool   `json:"default,omitempty"`
	AuthToken      string `json:"auth_token,omitempty"`
	TestsURL       string `json:"tests_url,omitempty" mapstructure:"tests_url"`
	CollectionsURL string `json:"collections_url,omitempty"`
	MessagesURL    string `json:"messages_url,omitempty"`
	TriggerURL     string `json:"trigger_url,omitempty"`
	VerifySsl      bool   `json:"verify_ssl,omitempty"`
	Team           *Team  `json:"team,omitempty"`
}

Bucket resources are a simple way to organize your requests and tests. See https://www.runscope.com/docs/api/buckets and https://www.runscope.com/docs/buckets

func (*Bucket) String

func (bucket *Bucket) String() string

type Client

type Client struct {
	APIURL      string
	AccessToken string
	HTTP        *http.Client
	sync.Mutex
}

Client provides access to create, read, update and delete runscope resources

func NewClient

func NewClient(apiURL string, accessToken string) *Client

NewClient creates a new client instance

func (*Client) CreateBucket

func (client *Client) CreateBucket(bucket *Bucket) (*Bucket, error)

CreateBucket creates a new bucket resource. See https://www.runscope.com/docs/api/buckets#bucket-create

func (*Client) CreateSchedule

func (client *Client) CreateSchedule(schedule *Schedule, bucketKey string, testID string) (*Schedule, error)

CreateSchedule creates a new test schedule. See https://www.runscope.com/docs/api/schedules#create

func (*Client) CreateSharedEnvironment

func (client *Client) CreateSharedEnvironment(environment *Environment, bucket *Bucket) (*Environment, error)

CreateSharedEnvironment creates a new shared environment. See https://www.runscope.com/docs/api/environments#create-shared

func (*Client) CreateTest

func (client *Client) CreateTest(test *Test) (*Test, error)

CreateTest creates a new runscope test. See https://www.runscope.com/docs/api/tests#create

func (*Client) CreateTestEnvironment

func (client *Client) CreateTestEnvironment(environment *Environment, test *Test) (*Environment, error)

CreateTestEnvironment creates a new test environment. See https://www.runscope.com/docs/api/environments#create

func (*Client) CreateTestStep

func (client *Client) CreateTestStep(testStep *TestStep, bucketKey string, testID string) (*TestStep, error)

CreateTestStep creates a new runscope test step. See https://www.runscope.com/docs/api/steps#add

func (*Client) DeleteBucket

func (client *Client) DeleteBucket(key string) error

DeleteBucket deletes a bucket by key. See https://www.runscope.com/docs/api/buckets#bucket-delete

func (*Client) DeleteBuckets

func (client *Client) DeleteBuckets(predicate func(bucket *Bucket) bool) error

DeleteBuckets deletes all buckets matching the predicate

func (*Client) DeleteEnvironment

func (client *Client) DeleteEnvironment(environment *Environment, bucket *Bucket) error

DeleteEnvironment deletes an existing shared environment. https://www.runscope.com/docs/api/environments#delete

func (*Client) DeleteSchedule

func (client *Client) DeleteSchedule(schedule *Schedule, bucketKey string, testID string) error

DeleteSchedule delete an existing test schedule. See https://www.runscope.com/docs/api/schedules#delete

func (*Client) DeleteTest

func (client *Client) DeleteTest(test *Test) error

DeleteTest delete an existing test. See https://www.runscope.com/docs/api/tests#delete

func (*Client) DeleteTestStep

func (client *Client) DeleteTestStep(testStep *TestStep, bucketKey string, testID string) error

DeleteTestStep delete an existing test step. https://www.runscope.com/docs/api/steps#delete

func (*Client) ListAllTests

func (client *Client) ListAllTests(input *ListTestsInput) ([]*Test, error)

ListAllTests lists all tests for a bucket

func (*Client) ListBuckets

func (client *Client) ListBuckets() ([]*Bucket, error)

ListBuckets lists all buckets for an account

func (*Client) ListIntegrations

func (client *Client) ListIntegrations(teamID string) ([]*Integration, error)

ListIntegrations list all configured integrations for your team. See https://www.runscope.com/docs/api/integrations

func (*Client) ListPeople

func (client *Client) ListPeople(teamID string) ([]*People, error)

ListPeople list all the people on your team. See https://www.runscope.com/docs/api/teams

func (*Client) ListSchedules

func (client *Client) ListSchedules(bucketKey string, testID string) ([]*Schedule, error)

ListSchedules list all the schedules for a given test. See https://www.runscope.com/docs/api/schedules#list

func (*Client) ListSharedEnvironment

func (client *Client) ListSharedEnvironment(bucket *Bucket) ([]*Environment, error)

ListSharedEnvironment lists all shared environments for a given bucket. See https://www.runscope.com/docs/api/environments#list-shared

func (*Client) ListTests

func (client *Client) ListTests(input *ListTestsInput) ([]*Test, error)

ListTests lists some tests given ListTestsInput

func (*Client) ReadBucket

func (client *Client) ReadBucket(key string) (*Bucket, error)

ReadBucket list details about an existing bucket resource. See https://www.runscope.com/docs/api/buckets#bucket-list

func (*Client) ReadSchedule

func (client *Client) ReadSchedule(schedule *Schedule, bucketKey string, testID string) (*Schedule, error)

ReadSchedule list details about an existing test schedule. See https://www.runscope.com/docs/api/schedules#detail

func (*Client) ReadSharedEnvironment

func (client *Client) ReadSharedEnvironment(environment *Environment, bucket *Bucket) (*Environment, error)

ReadSharedEnvironment lists details about an existing shared environment. See https://www.runscope.com/docs/api/environments#detail

func (*Client) ReadTest

func (client *Client) ReadTest(test *Test) (*Test, error)

ReadTest list details about an existing test. See https://www.runscope.com/docs/api/tests#detail

func (*Client) ReadTestEnvironment

func (client *Client) ReadTestEnvironment(environment *Environment, test *Test) (*Environment, error)

ReadTestEnvironment lists details about an existing test environment. See https://www.runscope.com/docs/api/environments#detail

func (*Client) ReadTestMetrics

func (client *Client) ReadTestMetrics(test *Test, input *ReadMetricsInput) (*TestMetric, error)

ReadTestMetrics retrieves metrics for a test. See https://www.runscope.com/docs/api/metrics

func (*Client) ReadTestStep

func (client *Client) ReadTestStep(testStep *TestStep, bucketKey string, testID string) (*TestStep, error)

ReadTestStep list details about an existing test step. https://www.runscope.com/docs/api/steps#detail

func (*Client) UpdateSchedule

func (client *Client) UpdateSchedule(schedule *Schedule, bucketKey string, testID string) (*Schedule, error)

UpdateSchedule updates an existing test schedule. See https://www.runscope.com/docs/api/schedules#modify

func (*Client) UpdateSharedEnvironment

func (client *Client) UpdateSharedEnvironment(environment *Environment, bucket *Bucket) (*Environment, error)

UpdateSharedEnvironment updates details about an existing shared environment. See https://www.runscope.com/docs/api/environments#modify

func (*Client) UpdateTest

func (client *Client) UpdateTest(test *Test) (*Test, error)

UpdateTest update an existing test. See https://www.runscope.com/docs/api/tests#modifying

func (*Client) UpdateTestEnvironment

func (client *Client) UpdateTestEnvironment(environment *Environment, test *Test) (*Environment, error)

UpdateTestEnvironment updates details about an existing test environment. See https://www.runscope.com/docs/api/environments#modify

func (*Client) UpdateTestStep

func (client *Client) UpdateTestStep(testStep *TestStep, bucketKey string, testID string) (*TestStep, error)

UpdateTestStep updates an existing test step. https://www.runscope.com/docs/api/steps#modify

type ClientAPI

type ClientAPI interface {
	CreateBucket(bucket *Bucket) (*Bucket, error)
	CreateSchedule(schedule *Schedule, bucketKey string, testID string) (*Schedule, error)
	CreateSharedEnvironment(environment *Environment, bucket *Bucket) (*Environment, error)
	CreateTest(test *Test) (*Test, error)
	CreateTestEnvironment(environment *Environment, test *Test) (*Environment, error)
	CreateTestStep(testStep *TestStep, bucketKey string, testID string) (*TestStep, error)
	DeleteBucket(key string) error
	DeleteBuckets(predicate func(bucket *Bucket) bool) error
	DeleteEnvironment(environment *Environment, bucket *Bucket) error
	DeleteSchedule(schedule *Schedule, bucketKey string, testID string) error
	DeleteTest(test *Test) error
	DeleteTestStep(testStep *TestStep, bucketKey string, testID string) error
	ListBuckets() ([]*Bucket, error)
	ListTests(input *ListTestsInput) ([]*Test, error)
	ListAllTests(input *ListTestsInput) ([]*Test, error)
	ListSchedules(bucketKey string, testID string) ([]*Schedule, error)
	ListIntegrations(teamID string) ([]*Integration, error)
	ListPeople(teamID string) ([]*People, error)
	ListSharedEnvironment(bucket *Bucket) ([]*Environment, error)
	ReadBucket(key string) (*Bucket, error)
	ReadSchedule(schedule *Schedule, bucketKey string, testID string) (*Schedule, error)
	ReadSharedEnvironment(environment *Environment, bucket *Bucket) (*Environment, error)
	ReadTest(test *Test) (*Test, error)
	ReadTestMetrics(test *Test, input *ReadMetricsInput) (*TestMetric, error)
	ReadTestEnvironment(environment *Environment, test *Test) (*Environment, error)
	ReadTestStep(testStep *TestStep, bucketKey string, testID string) (*TestStep, error)
	UpdateSchedule(schedule *Schedule, bucketKey string, testID string) (*Schedule, error)
	UpdateSharedEnvironment(environment *Environment, bucket *Bucket) (*Environment, error)
	UpdateTest(test *Test) (*Test, error)
	UpdateTestEnvironment(environment *Environment, test *Test) (*Environment, error)
	UpdateTestStep(testStep *TestStep, bucketKey string, testID string) (*TestStep, error)
}

ClientAPI interface for mocking data in unit tests

func NewClientAPI

func NewClientAPI(apiURL string, accessToken string) ClientAPI

NewClientAPI Interface initialization

type Contact

type Contact struct {
	Email string `json:"email,omitempty"`
	ID    string `json:"id"`
	Name  string `json:"name,omitempty"`
}

Contact details

type EmailSettings

type EmailSettings struct {
	NotifyAll       bool       `json:"notify_all,omitempty"`
	NotifyOn        string     `json:"notify_on,omitempty"`
	NotifyThreshold int        `json:"notify_threshold,omitempty"`
	Recipients      []*Contact `json:"recipients,omitempty"`
}

EmailSettings determining how test failures trigger notifications

type Environment

type Environment struct {
	ID                  string                    `json:"id,omitempty"`
	Name                string                    `json:"name,omitempty"`
	Script              string                    `json:"script,omitempty"`
	PreserveCookies     bool                      `json:"preserve_cookies"`
	TestID              string                    `json:"test_id,omitempty"`
	InitialVariables    map[string]string         `json:"initial_variables,omitempty"`
	Integrations        []*EnvironmentIntegration `json:"integrations,omitempty"`
	Regions             []string                  `json:"regions,omitempty"`
	VerifySsl           bool                      `json:"verify_ssl"`
	ExportedAt          *time.Time                `json:"exported_at,omitempty"`
	RetryOnFailure      bool                      `json:"retry_on_failure"`
	RemoteAgents        []*LocalMachine           `json:"remote_agents,omitempty"`
	WebHooks            []string                  `json:"webhooks,omitempty"`
	ParentEnvironmentID string                    `json:"parent_environment_id,omitempty"`
	EmailSettings       *EmailSettings            `json:"emails,omitempty"`
	ClientCertificate   string                    `json:"client_certificate,omitempty"`
}

Environment stores details for shared and test-specific environments. See https://www.runscope.com/docs/api/environments

func NewEnvironment

func NewEnvironment() *Environment

NewEnvironment creates a new environment

func (*Environment) String

func (environment *Environment) String() string

type EnvironmentIntegration

type EnvironmentIntegration struct {
	ID              string `json:"id"`
	IntegrationType string `json:"integration_type"`
	Description     string `json:"description,omitempty"`
}

EnvironmentIntegration represents an integration with a third-party. See https://www.runscope.com/docs/api/integrations

type Integration

type Integration struct {
	ID              string `json:"id"`
	UUID            string `json:"uuid"`
	IntegrationType string `json:"type"`
	Description     string `json:"description,omitempty"`
}

Integration represents an integration with a third-party. See https://www.runscope.com/docs/api/integrations

type ListTestsInput

type ListTestsInput struct {
	BucketKey string
	Count     int
	Offset    int
}

ListTestsInput represents the input to ListTests func

type LocalMachine

type LocalMachine struct {
	Name string `json:"name"`
	UUID string `json:"uuid"`
}

LocalMachine used in an environment to represent a remote agent

type People

type People struct {
	ID          string    `json:"id"`
	UUID        string    `json:"uuid"`
	Name        string    `json:"name"`
	Email       string    `json:"email"`
	CreatedAt   time.Time `json:"created_at"`
	LastLoginAt time.Time `json:"last_login_at"`
	GroupName   string    `json:"group_name"`
}

People represents a person belonging to a team. See https://www.runscope.com/docs/api/teams

type ReadMetricsInput

type ReadMetricsInput struct {
	Region          string
	Timeframe       string
	EnvironemntUUID string
}

type ResponseTime

type ResponseTime struct {
	SuccessRatio          float64 `json:"success_ratio,omitempty"`
	Timestamp             int64   `json:"timestamp,omitempty"`
	AverageResponseTimeMs int     `json:"avg_response_time_ms,omitempty"`
}

type Schedule

type Schedule struct {
	ID            string `json:"id,omitempty"`
	EnvironmentID string `json:"environment_id,omitempty"`
	Interval      string `json:"interval,omitempty"`
	Note          string `json:"note,omitempty"`
}

Schedule determines how often a test is executed. See https://www.runscope.com/docs/api/schedules

func NewSchedule

func NewSchedule() *Schedule

NewSchedule creates a new schedule struct

type Script

type Script struct {
	Value string `json:"value"`
}

Script not sure how this is used, currently not documented, but looks like a javascript string that gets evaluated? See See https://www.runscope.com/docs/api/steps

type Team

type Team struct {
	Name string
	ID   string
}

Team to which buckets belong to

type Test

type Test struct {
	ID                   string         `json:"id,omitempty"`
	Bucket               *Bucket        `json:"-"`
	Name                 string         `json:"name,omitempty"`
	Description          string         `json:"description,omitempty"`
	CreatedAt            *time.Time     `json:"created_at,omitempty"`
	CreatedBy            *Contact       `json:"created_by,omitempty"`
	DefaultEnvironmentID string         `json:"default_environment_id,omitempty"`
	ExportedAt           *time.Time     `json:"exported_at,omitempty"`
	Environments         []*Environment `json:"environments"`
	LastRun              *TestRun       `json:"last_run"`
	Steps                []*TestStep    `json:"steps"`
}

Test represents the details for a runscope test. See https://www.runscope.com/docs/api/tests

func NewTest

func NewTest() *Test

NewTest creates a new test struct

func (*Test) String

func (test *Test) String() string

type TestMetric

type TestMetric struct {
	ResponseTimes        []ResponseTime  `json:"response_times"`
	EnvironemntUUID      string          `json:"environment_uuid,omitempty"`
	Region               string          `json:"region,omitempty"`
	Timeframe            string          `json:"timeframe,omitempty"`
	ThisTimePeriod       TimePeriodMetic `json:"this_time_period"`
	ChangeFromLastPeriod TimePeriodMetic `json:"change_from_last_period"`
}

type TestRun

type TestRun struct {
	RemoteAgentUUID     string     `json:"remote_agent_uuid,omitempty"`
	FinishedAt          *time.Time `json:"finished_at,omitempty"`
	ErrorCount          int        `json:"error_count,omitempty"`
	MessageSuccess      int        `json:"message_success,omitempty"`
	TestUUID            string     `json:"test_uuid,omitempty"`
	ID                  string     `json:"id,omitempty"`
	ExtractorSuccess    int        `json:"extractor_success,omitempty"`
	UUID                string     `json:"uuid,omitempty"`
	EnvironmentUUID     string     `json:"environment_uuid,omitempty"`
	EnvironmentName     string     `json:"environment_name,omitempty"`
	Source              string     `json:"source,omitempty"`
	RemoteAgentName     string     `json:"remote_agent_name,omitempty"`
	RemoteAgent         string     `json:"remote_agent,omitempty"`
	Status              string     `json:"status,omitempty"`
	BucketKey           string     `json:"bucket_key,omitempty"`
	RemoteAgentVersion  string     `json:"remote_agent_version,omitempty"`
	SubstitutionSuccess int        `json:"substitution_success,omitempty"`
	MessageCount        int        `json:"message_count,omitempty"`
	ScriptCount         int        `json:"script_count,omitempty"`
	SubstitutionCount   int        `json:"substitution_count,omitempty"`
	ScriptSuccess       int        `json:"script_success,omitempty"`
	AssertionCount      int        `json:"assertion_count,omitempty"`
	AssertionSuccess    int        `json:"assertion_success,omitempty"`
	CreatedAt           *time.Time `json:"created_at,omitempty"`
	Messages            []string   `json:"messages,omitempty"`
	ExtractorCount      int        `json:"extractor_count,omitempty"`
	TemplateUUIDs       []string   `json:"template_uuids,omitempty"`
	Region              string     `json:"region,omitempty"`
}

TestRun represents the details of the last time the test ran

type TestStep

type TestStep struct {
	URL           string                 `json:"url,omitempty"`
	Variables     []*Variable            `json:"variables,omitempty"`
	Args          map[string]interface{} `json:"args,omitempty"`
	StepType      string                 `json:"step_type,omitempty"`
	Auth          map[string]string      `json:"auth,omitempty"`
	ID            string                 `json:"id,omitempty"`
	Body          string                 `json:"body,omitempty"`
	Note          string                 `json:"note,omitempty"`
	Headers       map[string][]string    `json:"headers,omitempty"`
	RequestID     string                 `json:"request_id,omitempty"`
	Assertions    []*Assertion           `json:"assertions,omitempty"`
	Scripts       []string               `json:"scripts,omitempty"`
	BeforeScripts []string               `json:"before_scripts,omitempty"`
	Method        string                 `json:"method,omitempty"`
}

TestStep represents each step that makes up part of the test. See https://www.runscope.com/docs/api/steps

func NewTestStep

func NewTestStep() *TestStep

NewTestStep creates a new test step struct

type TimePeriodMetic

type TimePeriodMetic struct {
	ResponseTime50thPercentile float64 `json:"response_time_50th_percentile,omitempty"`
	ResponseTime95thPercentile float64 `json:"response_time_95th_percentile,omitempty"`
	ResponseTime99thPercentile float64 `json:"response_time_99th_percentile,omitempty"`
	TotalTestRuns              float64 `json:"total_test_runs,omitempty"`
}

type Variable

type Variable struct {
	Name     string `json:"name,omitempty"`
	Property string `json:"property,omitempty"`
	Source   string `json:"source,omitempty"`
}

Variable allow you to extract data from request, subtest, and Ghost Inspector steps for use in subsequent steps in the test. Similar to Assertions, each variable is defined by a name, source, and property. See https://www.runscope.com/docs/api/steps#variables

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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