test

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package test provides a command line interface for running tests for a given openapi specification. You can run it `gofr genit -source=path/to/openapispec.yml -host=host:port`

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateIntegrationTest

func GenerateIntegrationTest(c *gofr.Context) (interface{}, error)

GenerateIntegrationTest generates an integration test based on parameters and swagger definitions, run tests against the provided host.

Types

type API

type API struct {
	Get    APIValues `yaml:"get"`
	Post   APIValues `yaml:"post"`
	Put    APIValues `yaml:"put"`
	Delete APIValues `yaml:"delete"`
}

type APIValues

type APIValues struct {
	Tags        []string            `yaml:"tags"`
	Summary     string              `yaml:"summary"`
	Description string              `yaml:"description"`
	Parameters  []Parameter         `yaml:"parameters"`
	Responses   map[string]Response `yaml:"responses"`
}

type IntegrationTestCase

type IntegrationTestCase struct {
	Endpoint             string
	Method               string
	ParamsJSONString     string
	Header               map[string][]string
	ExpectedResponseCode string
}

type IntegrationTestSchema

type IntegrationTestSchema struct {
	TestCases []IntegrationTestCase
}

type Parameter

type Parameter struct {
	Name        string `yaml:"name"`
	In          string `yaml:"in"`
	Description string `yaml:"description"`
	Schema      struct {
		Type string `yaml:"type"`
	} `yaml:"schema"`
	Example interface{} `yaml:"example"`
}

type Response

type Response struct {
	Description string `yaml:"description"`
	Content     struct {
		ApplicationJSON interface{} `yaml:"application/json"`
	}
}

type Swagger

type Swagger struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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