Documentation ¶
Overview ¶
Package manatest provides internal workings for go-mana-test.
Package manatest provides internal workings for go-mana-test.
Package manatest provides internal workings for go-mana-test.
Package manatest provides internal workings for go-mana-test.
Package manatest provides internal workings for go-mana-test.
Package manatest provides internal workings for go-mana-test.
Index ¶
- Constants
- func ClearCache()
- func GetCache(key string) string
- func GetCacheKeys() []string
- func ReplaceCache(str string) string
- func ReplaceEnvironmentVars(str string) string
- func ReplaceGlobalVars(str string, vars *[]ProjectGlobal) string
- func ReplaceRandomNumber(str string) string
- func ReplaceRandomString(str string) string
- func ReplaceRandomStringLower(str string) string
- func ReplaceRandomStringUpper(str string) string
- func ReplaceVarsInCheck(str string, vars *[]ProjectGlobal) string
- func ReplaceVarsInGlobal(str string) string
- func ReplaceVarsInHeader(str string, vars *[]ProjectGlobal) string
- func ReplaceVarsInRequestBody(str string, vars *[]ProjectGlobal) string
- func ReplaceVarsInTestURL(str string, vars *[]ProjectGlobal) string
- func RunChecks(checks *[]TestChecks, vars *[]ProjectGlobal, response *resty.Response) error
- func SaveCacheFromResponse(caches *[]TestCache, response *resty.Response) error
- func SetCache(key string, value string)
- func ValidateCacheValue(value *string) bool
- func ValidateCheck(check *string) bool
- type ProjectFile
- type ProjectGlobal
- type TestCache
- type TestChecks
- type TestFile
- type TestHeader
Constants ¶
const ( CheckResCode = "response.code" CheckResBodyJSON = "response.body.json" )
Checks.
const (
CacheBodyJSON = "response.body.json"
)
Cache.
Variables ¶
This section is empty.
Functions ¶
func ReplaceEnvironmentVars ¶ added in v0.2.0
ReplaceEnvironmentVars Replaces environment variables.
func ReplaceGlobalVars ¶
func ReplaceGlobalVars(str string, vars *[]ProjectGlobal) string
ReplaceGlobalVars Replaces global variables in a string.
func ReplaceRandomNumber ¶
ReplaceRandomNumber Replaces random number.
func ReplaceRandomString ¶
ReplaceRandomString Replaces random string.
func ReplaceRandomStringLower ¶
ReplaceRandomStringLower Replaces random string lower.
func ReplaceRandomStringUpper ¶
ReplaceRandomStringUpper Replaces random string upper.
func ReplaceVarsInCheck ¶ added in v0.2.0
func ReplaceVarsInCheck(str string, vars *[]ProjectGlobal) string
ReplaceVarsInCheck Replaces variables in a test check.
func ReplaceVarsInGlobal ¶ added in v0.2.0
ReplaceVarsInGlobal Replaces variables in global.
func ReplaceVarsInHeader ¶ added in v0.2.0
func ReplaceVarsInHeader(str string, vars *[]ProjectGlobal) string
ReplaceVarsInHeader Replaces variables in a test check.
func ReplaceVarsInRequestBody ¶ added in v0.2.0
func ReplaceVarsInRequestBody(str string, vars *[]ProjectGlobal) string
ReplaceVarsInRequestBody Replaces variables in a request body.
func ReplaceVarsInTestURL ¶ added in v0.2.0
func ReplaceVarsInTestURL(str string, vars *[]ProjectGlobal) string
ReplaceVarsInTestURL Replaces variables in a test URL.
func RunChecks ¶
func RunChecks(checks *[]TestChecks, vars *[]ProjectGlobal, response *resty.Response) error
RunChecks Runs checks for a test and a project.
func SaveCacheFromResponse ¶
SaveCacheFromResponse Saves cache from response.
func ValidateCacheValue ¶
ValidateCacheValue Validates cache value.
Types ¶
type ProjectFile ¶
type ProjectFile struct { // Name, stores the name of the test. Name string `yaml:"name"` // Tests, stores the paths to tests. Tests string `yaml:"tests"` // Globals, stores the global variables. Globals []ProjectGlobal `yaml:"globals"` // contains filtered or unexported fields }
ProjectFile is a structure to handle a project file.
func ReadProjectFile ¶
func ReadProjectFile(pathFile string) (*ProjectFile, error)
ReadProjectFile Reads a project file.
func (*ProjectFile) GetFilePath ¶
func (projFile *ProjectFile) GetFilePath() string
GetFilePath Gets the path to the project file.
func (*ProjectFile) GetPath ¶
func (projFile *ProjectFile) GetPath() string
GetPath Gets the path of the project file.
func (*ProjectFile) Validate ¶
func (projFile *ProjectFile) Validate() error
Validate Validates a project file is in proper format.
type ProjectGlobal ¶
type ProjectGlobal struct { // Key, hold the key of the variable. Key string // Value, hold the value of the variable. Value string }
ProjectGlobal is a structure to handle a global variables for a project.
type TestCache ¶
type TestCache struct { // Name, hold the name of this check for the test. Name string `yaml:"name"` // Value, hold the value of the test. Value string `yaml:"value"` }
TestCache is a structure to handle cache for a test.
type TestChecks ¶
type TestChecks struct { // Name, hold the name of this check for the test. Name string `yaml:"name"` // Check, hold the check for the test. Check string `yaml:"check"` // Value, hold the value of the test. Value string `yaml:"value"` }
TestChecks is a structure to handle checks for a test.
type TestFile ¶
type TestFile struct { // Name, stores the name of the test. Name string `yaml:"name"` // Index, hold the index of this test. Index int `yaml:"index"` // URL, stores the url of the test. URL string `yaml:"url"` // Parms, key/val params to be attached to the URL Params map[string]string `yaml:"params"` // Method, stores the http method of the test. RequestMethod string `yaml:"request.method"` // Headers, stores the header variables. RequestHeaders []TestHeader `yaml:"request.headers"` // Body, stores the test http body. ReqBody interface{} `yaml:"request.body"` // TestChecks, stores the checks variables. Checks []TestChecks `yaml:"checks"` // Cache, stores the cache variables. Cache []TestCache `yaml:"cache"` // contains filtered or unexported fields }
TestFile is a structure to handle an individual test file.
func GatherTestFiles ¶
GatherTestFiles Gathers all test files at a path.
func ReadTestFile ¶
ReadTestFile Reads a test file.
func (*TestFile) GetFilePath ¶
GetFilePath Gets the path to the test file.
func (*TestFile) MakeTestHeaders ¶ added in v0.2.0
func (testFile *TestFile) MakeTestHeaders(projFile *ProjectFile) []TestHeader
MakeTestHeaders Prepares HTTP headers for the test but replacing necessary variables.
func (*TestFile) MakeTestURL ¶ added in v0.2.0
func (testFile *TestFile) MakeTestURL(projFile *ProjectFile) string
MakeTestURL Prepares HTTP URL for the test but replacing necessary variables.
type TestHeader ¶
type TestHeader struct { // Key, hold the key of the header. Key string `yaml:"key"` // Value, hold the value of the header. Value string `yaml:"value"` }
TestHeader is a structure to handle headers for a test.