-
Notifications
You must be signed in to change notification settings - Fork 25
feat: support api layer and global headers for testcase #94 #95 #133
feat: support api layer and global headers for testcase #94 #95 #133
Conversation
31f6703
to
28e30ca
Compare
ad02742
to
bb69fd8
Compare
Codecov Report
@@ Coverage Diff @@
## main #133 +/- ##
==========================================
+ Coverage 55.87% 57.51% +1.63%
==========================================
Files 29 29
Lines 3912 4100 +188
==========================================
+ Hits 2186 2358 +172
- Misses 1558 1576 +18
+ Partials 168 166 -2
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
3c39000
to
649248a
Compare
examples/postman-echo.json
Outdated
} | ||
}, | ||
"validate": [ | ||
{ | ||
"check": "status_code", | ||
"assert": "equals", | ||
"expect": 200, | ||
"expect": 401, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里预期应该还是 200,这里应该是认证信息失效了;先不改这部分,后面看下怎么处理下认证的问题
models.go
Outdated
@@ -117,17 +118,28 @@ type Validator struct { | |||
type TStep struct { | |||
Name string `json:"name" yaml:"name"` // required | |||
Request *Request `json:"request,omitempty" yaml:"request,omitempty"` | |||
TestCase *TestCase `json:"testcase,omitempty" yaml:"testcase,omitempty"` | |||
API string `json:"api,omitempty" yaml:"api,omitempty"` | |||
TestCase interface{} `json:"testcase,omitempty" yaml:"testcase,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TestCase 和 API 都是引用,那这里是不是都统一为 string 好些?
} | ||
|
||
for _, value := range overriddenSlice { | ||
if !builtin.Contains(slice, value) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1、这里为什么需要忽略大小写?
2、即使需要忽略,在这里处理会导致 mergeSlices 函数有隐藏逻辑
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里再看下上面的评论
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里是直接引用hubble-go的实现,是我考虑不周,我改下
convert.go
Outdated
tc := &TCase{} | ||
decoder := json.NewDecoder(bytes.NewReader(file)) | ||
decoder.UseNumber() | ||
err = decoder.Decode(tc) | ||
// compatible test scenario with a single API | ||
e := json.Get(file, "request") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
json.Get(file, "request").LastError()
response.go
Outdated
@@ -99,15 +99,15 @@ func (v *responseObject) extractField(value string) interface{} { | |||
return result | |||
} | |||
|
|||
func (v *responseObject) Extract(extractors map[string]string) map[string]interface{} { | |||
func (v *responseObject) Extract(extractors map[string]interface{}) map[string]interface{} { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extract 改回 map[string]string
6e342d8
to
f2b8d76
Compare
f2b8d76
to
af6c433
Compare
feat: support global headers for testcase #95
feat: support API layer for testcase #94
feat: support referenced testcase by using specify testcase path in testcase script and override testcase config
fix: decode failed when content-encoding is deflate
fix: unstable RPS when high concurrency load testing