@@ -2,19 +2,19 @@ package testing
22
33// TestSuite represents a set of test cases
44type TestSuite struct {
5- Name string `yaml:"name"`
6- API string `yaml:"api"`
7- Items []TestCase `yaml:"items"`
5+ Name string `yaml:"name" json:"name" `
6+ API string `yaml:"api,omitempty" json:"api,omitempty "`
7+ Items []TestCase `yaml:"items" json:"items" `
88}
99
1010// TestCase represents a test case
1111type TestCase struct {
12- Name string
12+ Name string `yaml:"name" json:"name"`
1313 Group string
14- Prepare Prepare `yaml:"prepare"`
15- Request Request `yaml:"request"`
16- Expect Response `yaml:"expect"`
17- Clean Clean `yaml:"clean"`
14+ Prepare Prepare `yaml:"prepare" json:"-" `
15+ Request Request `yaml:"request" json:"request" `
16+ Expect Response `yaml:"expect" json:"expect" `
17+ Clean Clean `yaml:"clean" json:"-" `
1818}
1919
2020// Prepare does the prepare work
@@ -24,22 +24,22 @@ type Prepare struct {
2424
2525// Request represents a HTTP request
2626type Request struct {
27- API string `yaml:"api"`
28- Method string `yaml:"method"`
29- Query map [string ]string `yaml:"query"`
30- Header map [string ]string `yaml:"header"`
31- Form map [string ]string `yaml:"form"`
32- Body string `yaml:"body"`
33- BodyFromFile string `yaml:"bodyFromFile"`
27+ API string `yaml:"api" json:"api" `
28+ Method string `yaml:"method,omitempty" json:"method,omitempty" jsonschema:"enum=GET,enum=POST,enum=PUT,enum=DELETE "`
29+ Query map [string ]string `yaml:"query" json:"query,omitempty" `
30+ Header map [string ]string `yaml:"header" json:"header,omitempty" `
31+ Form map [string ]string `yaml:"form" json:"form,omitempty" `
32+ Body string `yaml:"body" json:"body,omitempty" `
33+ BodyFromFile string `yaml:"bodyFromFile" json:"bodyFromFile,omitempty" `
3434}
3535
3636// Response is the expected response
3737type Response struct {
38- StatusCode int `yaml:"statusCode"`
39- Body string `yaml:"body"`
40- Header map [string ]string `yaml:"header"`
41- BodyFieldsExpect map [string ]interface {} `yaml:"bodyFieldsExpect"`
42- Verify []string `yaml:"verify"`
38+ StatusCode int `yaml:"statusCode" json:"bodyFromFile,omitempty" `
39+ Body string `yaml:"body" json:"body,omitempty" `
40+ Header map [string ]string `yaml:"header" json:"header,omitempty" `
41+ BodyFieldsExpect map [string ]interface {} `yaml:"bodyFieldsExpect" json:"bodyFieldsExpect,omitempty" `
42+ Verify []string `yaml:"verify" json:"verify,omitempty" `
4343}
4444
4545// Clean represents the clean work after testing
0 commit comments