testconfig

package
v0.5.5 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2016 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PackageInfo

type PackageInfo int

func (PackageInfo) ConvertOsPath

func (i PackageInfo) ConvertOsPath(s string) string

convert path strings in a string provided

func (PackageInfo) DirExists

func (i PackageInfo) DirExists(path string) (bool, error)

check if a dir exist

func (PackageInfo) GetPackageRootDir

func (i PackageInfo) GetPackageRootDir(package_path string) (exist bool, path string)

Get the location of a package dir mostly useful for test cases

func (PackageInfo) JoinPath

func (i PackageInfo) JoinPath(paths []string) string

os join paths

type TestCases

type TestCases struct {
	Name        string                 `json:"name,omitempty"`
	Enabled     bool                   `json:"enabled,omitempty"`
	TestData    map[string]interface{} `json:"test_data,omitempty"`    // map[string]interface{}{"test_data": []interface{}}
	ExpectsData map[string]interface{} `json:"expects_data,omitempty"` // map[string]interface{}{"expects_data": []interface{}}
}

test case objects { "name" : "PROTEST",

"cases": [
   {
      "name": "TestName1",   // function name of the test case
      "enabled": true,        // flag to determine if we do the test case or skip
      "TestData" : map[string][interface{ }] // list of test data by name
      "ExpectsData" : map[string][interface{}] // expects results
   },
   {
     ....
   },

] }

type TestConfig

type TestConfig struct {
	Cases []TestCases `json:"cases,omitempty"` // "cases":[]
	Name  string      `json:"name,omitempty"`  // "name": "PROTEST",
}

test case objects

see testcases.go for test case methods

{ "name" : "PROTEST",

"cases": [
   {
     ...
   },

] }

func (*TestConfig) EqualFaceI

func (tc *TestConfig) EqualFaceI(f interface{}, i int) bool

compare test data to a int num

func (*TestConfig) EqualFaceS

func (tc *TestConfig) EqualFaceS(is interface{}, s string) bool

Compare interface to string doesn't seem to really be needed....

func (*TestConfig) GetExpectsData

func (tc *TestConfig) GetExpectsData(tc_name string, k string) interface{}

get expects data, returns interface because the data type is unknown use tc Equal arguments for type comparison, conversions or assert the type

func (*TestConfig) GetTestCases

func (tc *TestConfig) GetTestCases(tc_name string) (t TestCases)

Get a test case by name

func (*TestConfig) GetTestData

func (tc *TestConfig) GetTestData(tc_name string, k string) interface{}

get test data

func (*TestConfig) GetTestingConfiguration

func (tc *TestConfig) GetTestingConfiguration(config_name string)

get config for testing Examples cv := tc.GetExpectsData("TestGetAPIVersion", "CurrentVersion") log.Infof("tc test_data -> %s\n", tc.EqualFaceI(cv, 120)) log.Infof("2 tc compare s -> %s\n", tc.GetExpectsData("TestGetAPIVersion", "FakeData") == "foo") log.Infof("tc compare s -> %s\n", tc.EqualFaceS(tc.GetExpectsData("TestGetAPIVersion", "FakeData"), "foo")) log.Infof("get no test data -> %+v \n", tc.GetTestData("TestGetAPIVersion", "Surprise")) log.Infof("is test enabled -> %+v \n", tc.IsTestEnabled("TestGetAPIVersion"))

func (*TestConfig) IsTestEnabled

func (tc *TestConfig) IsTestEnabled(tc_name string) bool

is test case enabled? defaults are always true

func (*TestConfig) NewTestConfig

func (tc *TestConfig) NewTestConfig() *TestConfig

setup Testing

func (*TestConfig) UnMarshallTestingConfig

func (tc *TestConfig) UnMarshallTestingConfig(json_data []byte)

UnMarshall json to data

Jump to

Keyboard shortcuts

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