feat: support api layer and global headers for testcase

This commit is contained in:
xucong053
2022-03-15 12:39:41 +08:00
parent 2585670030
commit ee679a7bc2
37 changed files with 907 additions and 135 deletions

View File

@@ -7,16 +7,21 @@ import (
)
var (
demoTestCaseJSONPath = "examples/demo.json"
demoTestCaseYAMLPath = "examples/demo.yaml"
demoTestCaseJSONPath TestCasePath = "examples/demo.json"
demoTestCaseYAMLPath TestCasePath = "examples/demo.yaml"
demoRefAPIYAMLPath TestCasePath = "examples/ref_api_test.yaml"
demoRefTestCaseJSONPath TestCasePath = "examples/ref_testcase_test.json"
demoAPIYAMLPath APIPath = "examples/api/put.yml"
)
func TestLoadCase(t *testing.T) {
tcJSON, err := loadFromJSON(demoTestCaseJSONPath)
tcJSON := &TCase{}
tcYAML := &TCase{}
err := loadFromJSON(demoTestCaseJSONPath.ToString(), tcJSON)
if !assert.NoError(t, err) {
t.Fail()
}
tcYAML, err := loadFromYAML(demoTestCaseYAMLPath)
err = loadFromYAML(demoTestCaseYAMLPath.ToString(), tcYAML)
if !assert.NoError(t, err) {
t.Fail()
}