testing

package
v1.3.84 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TestCaseMapperInstance = NewTestCaseMapper()
View Source
var TestCaseResource = &model.Resource{
	Name:        "TestCase",
	Namespace:   "testing",
	Title:       util.Pointer("Test Case"),
	Description: util.Pointer("Test Case is a test case"),
	Types: []*model.ResourceSubType{
		{
			Name: "TestCaseStep",
			Properties: []*model.ResourceProperty{
				{
					Name:       "operation",
					Type:       model.ResourceProperty_ENUM,
					Required:   true,
					EnumValues: []string{"CREATE", "UPDATE", "APPLY", "DELETE", "GET", "LIST", "NANO"},
				},
				{
					Name: "payload",
					Type: model.ResourceProperty_OBJECT,
				},
				{
					Name:   "name",
					Type:   model.ResourceProperty_STRING,
					Length: 255,
					Unique: true,
				},
			},

			Annotations: map[string]string{
				"NormalizedResource": "true",
			},
		},
		{
			Name: "TestCaseAssertion",
			Properties: []*model.ResourceProperty{
				{
					Name: "errorCode",
					Type: model.ResourceProperty_STRING,
				},
				{
					Name: "errorMessage",
					Type: model.ResourceProperty_STRING,
				},
				{
					Name:   "name",
					Type:   model.ResourceProperty_STRING,
					Length: 255,
				},
				{
					Name:       "assertionType",
					Type:       model.ResourceProperty_ENUM,
					Required:   true,
					EnumValues: []string{"EQUAL", "NOT_EQUAL", "EXPECT_ERROR", "NANO"},
				},
				{
					Name: "left",
					Type: model.ResourceProperty_STRING,
				},
				{
					Name: "right",
					Type: model.ResourceProperty_OBJECT,
				},
				{
					Name: "script",
					Type: model.ResourceProperty_STRING,
				},
			},

			Annotations: map[string]string{
				"NormalizedResource": "true",
			},
		},
	},
	Properties: []*model.ResourceProperty{
		{
			Name:         "id",
			Type:         model.ResourceProperty_UUID,
			Required:     true,
			Immutable:    true,
			ExampleValue: structpb.NewStringValue("a39621a4-6d48-11ee-b962-0242ac120002"),

			Annotations: map[string]string{
				"SpecialProperty": "true",
				"PrimaryProperty": "true",
			},
		},
		{
			Name: "steps",
			Type: model.ResourceProperty_LIST,
			Item: &model.ResourceProperty{
				Name:    "",
				Type:    model.ResourceProperty_STRUCT,
				TypeRef: util.Pointer("TestCaseStep"),
			},
		},
		{
			Name: "assertions",
			Type: model.ResourceProperty_LIST,
			Item: &model.ResourceProperty{
				Name:    "",
				Type:    model.ResourceProperty_STRUCT,
				TypeRef: util.Pointer("TestCaseAssertion"),
			},
		},
		{
			Name:         "autoRun",
			Type:         model.ResourceProperty_BOOL,
			Required:     true,
			DefaultValue: nil,
		},
		{
			Name:     "name",
			Type:     model.ResourceProperty_STRING,
			Length:   255,
			Required: true,
			Unique:   true,
		},
		{
			Name:   "description",
			Type:   model.ResourceProperty_STRING,
			Length: 64000,
		},
		{
			Name: "annotations",
			Type: model.ResourceProperty_MAP,
			Item: &model.ResourceProperty{
				Name: "",
				Type: model.ResourceProperty_STRING,
			},
		},
		{
			Name:         "version",
			Type:         model.ResourceProperty_INT32,
			Required:     true,
			DefaultValue: structpb.NewNumberValue(1),
			ExampleValue: structpb.NewNumberValue(1),

			Annotations: map[string]string{
				"SpecialProperty":     "true",
				"AllowEmptyPrimitive": "true",
			},
		},
	},

	Annotations: map[string]string{
		"NormalizedResource": "true",
	},
}
View Source
var TestCaseTestCaseAssertionMapperInstance = NewTestCaseTestCaseAssertionMapper()
View Source
var TestCaseTestCaseStepMapperInstance = NewTestCaseTestCaseStepMapper()
View Source
var TestExecutionMapperInstance = NewTestExecutionMapper()
View Source
var TestExecutionResource = &model.Resource{
	Name:        "TestExecution",
	Namespace:   "testing",
	Title:       util.Pointer("Test Case"),
	Description: util.Pointer("Test Case is a test case"),
	Properties: []*model.ResourceProperty{
		{
			Name:         "id",
			Type:         model.ResourceProperty_UUID,
			Required:     true,
			Immutable:    true,
			ExampleValue: structpb.NewStringValue("a39621a4-6d48-11ee-b962-0242ac120002"),

			Annotations: map[string]string{
				"PrimaryProperty": "true",
				"SpecialProperty": "true",
			},
		},
		{
			Name:         "stored",
			Type:         model.ResourceProperty_BOOL,
			Required:     true,
			DefaultValue: nil,
		},
		{
			Name:     "name",
			Type:     model.ResourceProperty_STRING,
			Length:   255,
			Required: true,
			Unique:   true,
		},
		{
			Name:      "testCase",
			Type:      model.ResourceProperty_REFERENCE,
			Required:  true,
			Reference: &model.Reference{Resource: "TestCase", Namespace: "testing"},
		},
		{
			Name:       "result",
			Type:       model.ResourceProperty_ENUM,
			EnumValues: []string{"SUCCESS", "FAILURE"},
		},
		{
			Name:   "logs",
			Type:   model.ResourceProperty_STRING,
			Length: 64000,
		},
		{
			Name:         "version",
			Type:         model.ResourceProperty_INT32,
			Required:     true,
			DefaultValue: structpb.NewNumberValue(1),
			ExampleValue: structpb.NewNumberValue(1),

			Annotations: map[string]string{
				"SpecialProperty":     "true",
				"AllowEmptyPrimitive": "true",
			},
		},
	},
	Indexes: []*model.ResourceIndex{
		{
			Properties: []*model.ResourceIndexProperty{
				{
					Name:  "testCase",
					Order: model.Order_ORDER_UNKNOWN,
				},
				{
					Name:  "name",
					Order: model.Order_ORDER_UNKNOWN,
				},
			},
			IndexType: model.ResourceIndexType_BTREE,
			Unique:    true,
		},
	},

	Annotations: map[string]string{
		"NormalizedResource": "true",
	},
}

Functions

func NewModule

func NewModule(container service.Container) service.Module

Types

type TestCase

type TestCase struct {
	Id          *uuid.UUID                  `json:"id,omitempty"`
	Steps       []TestCaseTestCaseStep      `json:"steps,omitempty"`
	Assertions  []TestCaseTestCaseAssertion `json:"assertions,omitempty"`
	AutoRun     bool                        `json:"autoRun,omitempty"`
	Name        string                      `json:"name,omitempty"`
	Description *string                     `json:"description,omitempty"`
	Annotations map[string]string           `json:"annotations,omitempty"`
	Version     int32                       `json:"version,omitempty"`
}

func (*TestCase) GetAnnotations

func (s *TestCase) GetAnnotations() map[string]string

func (*TestCase) GetAssertions

func (s *TestCase) GetAssertions() []TestCaseTestCaseAssertion

func (*TestCase) GetAutoRun

func (s *TestCase) GetAutoRun() bool

func (*TestCase) GetDescription

func (s *TestCase) GetDescription() *string

func (*TestCase) GetId

func (s *TestCase) GetId() *uuid.UUID

func (*TestCase) GetName

func (s *TestCase) GetName() string

func (*TestCase) GetSteps

func (s *TestCase) GetSteps() []TestCaseTestCaseStep

func (*TestCase) GetVersion

func (s *TestCase) GetVersion() int32

type TestCaseAssertionType

type TestCaseAssertionType string
const (
	TestCaseAssertionType_EQUAL       TestCaseAssertionType = "EQUAL"
	TestCaseAssertionType_NOTEQUAL    TestCaseAssertionType = "NOT_EQUAL"
	TestCaseAssertionType_EXPECTERROR TestCaseAssertionType = "EXPECT_ERROR"
	TestCaseAssertionType_NANO        TestCaseAssertionType = "NANO"
)

type TestCaseMapper

type TestCaseMapper struct {
}

func NewTestCaseMapper

func NewTestCaseMapper() *TestCaseMapper

func (*TestCaseMapper) FromProperties

func (m *TestCaseMapper) FromProperties(properties map[string]*structpb.Value) *TestCase

func (*TestCaseMapper) FromRecord

func (m *TestCaseMapper) FromRecord(record *model.Record) *TestCase

func (*TestCaseMapper) New

func (m *TestCaseMapper) New() *TestCase

func (*TestCaseMapper) ResourceIdentity

func (m *TestCaseMapper) ResourceIdentity() abs.ResourceIdentity

func (*TestCaseMapper) ToProperties

func (m *TestCaseMapper) ToProperties(testCase *TestCase) map[string]*structpb.Value

func (*TestCaseMapper) ToRecord

func (m *TestCaseMapper) ToRecord(testCase *TestCase) *model.Record

type TestCaseOperation

type TestCaseOperation string
const (
	TestCaseOperation_CREATE TestCaseOperation = "CREATE"
	TestCaseOperation_UPDATE TestCaseOperation = "UPDATE"
	TestCaseOperation_APPLY  TestCaseOperation = "APPLY"
	TestCaseOperation_DELETE TestCaseOperation = "DELETE"
	TestCaseOperation_GET    TestCaseOperation = "GET"
	TestCaseOperation_LIST   TestCaseOperation = "LIST"
	TestCaseOperation_NANO   TestCaseOperation = "NANO"
)

type TestCaseTestCaseAssertion

type TestCaseTestCaseAssertion struct {
	ErrorCode     *string               `json:"errorCode,omitempty"`
	ErrorMessage  *string               `json:"errorMessage,omitempty"`
	Name          *string               `json:"name,omitempty"`
	AssertionType TestCaseAssertionType `json:"assertionType,omitempty"`
	Left          *string               `json:"left,omitempty"`
	Right         interface{}           `json:"right,omitempty"`
	Script        *string               `json:"script,omitempty"`
}

func (*TestCaseTestCaseAssertion) GetAssertionType

func (s *TestCaseTestCaseAssertion) GetAssertionType() TestCaseAssertionType

func (*TestCaseTestCaseAssertion) GetErrorCode

func (s *TestCaseTestCaseAssertion) GetErrorCode() *string

func (*TestCaseTestCaseAssertion) GetErrorMessage

func (s *TestCaseTestCaseAssertion) GetErrorMessage() *string

func (*TestCaseTestCaseAssertion) GetLeft

func (s *TestCaseTestCaseAssertion) GetLeft() *string

func (*TestCaseTestCaseAssertion) GetName

func (s *TestCaseTestCaseAssertion) GetName() *string

func (*TestCaseTestCaseAssertion) GetRight

func (s *TestCaseTestCaseAssertion) GetRight() interface{}

func (*TestCaseTestCaseAssertion) GetScript

func (s *TestCaseTestCaseAssertion) GetScript() *string

type TestCaseTestCaseAssertionMapper

type TestCaseTestCaseAssertionMapper struct {
}

func NewTestCaseTestCaseAssertionMapper

func NewTestCaseTestCaseAssertionMapper() *TestCaseTestCaseAssertionMapper

func (*TestCaseTestCaseAssertionMapper) FromProperties

func (*TestCaseTestCaseAssertionMapper) New

func (*TestCaseTestCaseAssertionMapper) ResourceIdentity

func (*TestCaseTestCaseAssertionMapper) ToProperties

func (m *TestCaseTestCaseAssertionMapper) ToProperties(testCaseTestCaseAssertion *TestCaseTestCaseAssertion) map[string]*structpb.Value

type TestCaseTestCaseStep

type TestCaseTestCaseStep struct {
	Operation TestCaseOperation `json:"operation,omitempty"`
	Payload   interface{}       `json:"payload,omitempty"`
	Name      *string           `json:"name,omitempty"`
}

func (*TestCaseTestCaseStep) GetName

func (s *TestCaseTestCaseStep) GetName() *string

func (*TestCaseTestCaseStep) GetOperation

func (s *TestCaseTestCaseStep) GetOperation() TestCaseOperation

func (*TestCaseTestCaseStep) GetPayload

func (s *TestCaseTestCaseStep) GetPayload() interface{}

type TestCaseTestCaseStepMapper

type TestCaseTestCaseStepMapper struct {
}

func NewTestCaseTestCaseStepMapper

func NewTestCaseTestCaseStepMapper() *TestCaseTestCaseStepMapper

func (*TestCaseTestCaseStepMapper) FromProperties

func (m *TestCaseTestCaseStepMapper) FromProperties(properties map[string]*structpb.Value) *TestCaseTestCaseStep

func (*TestCaseTestCaseStepMapper) New

func (*TestCaseTestCaseStepMapper) ResourceIdentity

func (m *TestCaseTestCaseStepMapper) ResourceIdentity() abs.ResourceIdentity

func (*TestCaseTestCaseStepMapper) ToProperties

func (m *TestCaseTestCaseStepMapper) ToProperties(testCaseTestCaseStep *TestCaseTestCaseStep) map[string]*structpb.Value

type TestExecution

type TestExecution struct {
	Id       *uuid.UUID           `json:"id,omitempty"`
	Stored   bool                 `json:"stored,omitempty"`
	Name     string               `json:"name,omitempty"`
	TestCase *TestCase            `json:"testCase,omitempty"`
	Result   *TestExecutionResult `json:"result,omitempty"`
	Logs     *string              `json:"logs,omitempty"`
	Version  int32                `json:"version,omitempty"`
}

func (*TestExecution) GetId

func (s *TestExecution) GetId() *uuid.UUID

func (*TestExecution) GetLogs

func (s *TestExecution) GetLogs() *string

func (*TestExecution) GetName

func (s *TestExecution) GetName() string

func (*TestExecution) GetResult

func (s *TestExecution) GetResult() *TestExecutionResult

func (*TestExecution) GetStored

func (s *TestExecution) GetStored() bool

func (*TestExecution) GetTestCase

func (s *TestExecution) GetTestCase() *TestCase

func (*TestExecution) GetVersion

func (s *TestExecution) GetVersion() int32

type TestExecutionMapper

type TestExecutionMapper struct {
}

func NewTestExecutionMapper

func NewTestExecutionMapper() *TestExecutionMapper

func (*TestExecutionMapper) FromProperties

func (m *TestExecutionMapper) FromProperties(properties map[string]*structpb.Value) *TestExecution

func (*TestExecutionMapper) FromRecord

func (m *TestExecutionMapper) FromRecord(record *model.Record) *TestExecution

func (*TestExecutionMapper) New

func (*TestExecutionMapper) ResourceIdentity

func (m *TestExecutionMapper) ResourceIdentity() abs.ResourceIdentity

func (*TestExecutionMapper) ToProperties

func (m *TestExecutionMapper) ToProperties(testExecution *TestExecution) map[string]*structpb.Value

func (*TestExecutionMapper) ToRecord

func (m *TestExecutionMapper) ToRecord(testExecution *TestExecution) *model.Record

type TestExecutionResult

type TestExecutionResult string
const (
	TestExecutionResult_SUCCESS TestExecutionResult = "SUCCESS"
	TestExecutionResult_FAILURE TestExecutionResult = "FAILURE"
)

Jump to

Keyboard shortcuts

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