Skip to content
This repository has been archived by the owner on Mar 28, 2022. It is now read-only.

feat: support api layer and global headers for testcase #94 #95 #133

Merged
merged 1 commit into from
Mar 15, 2022

Conversation

xucong053
Copy link
Collaborator

@xucong053 xucong053 commented Mar 9, 2022

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

@xucong053 xucong053 force-pushed the support-api-layer-for-testcase branch 2 times, most recently from 31f6703 to 28e30ca Compare March 9, 2022 13:44
convert.go Outdated Show resolved Hide resolved
examples/api/get.json Outdated Show resolved Hide resolved
@xucong053 xucong053 force-pushed the support-api-layer-for-testcase branch 3 times, most recently from ad02742 to bb69fd8 Compare March 10, 2022 07:06
@codecov-commenter
Copy link

codecov-commenter commented Mar 10, 2022

Codecov Report

Merging #133 (af6c433) into main (3b9e6cd) will increase coverage by 1.63%.
The diff coverage is 70.34%.

Impacted file tree graph

@@            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     
Flag Coverage Δ
unittests 57.51% <70.34%> (+1.63%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
cli/hrp/cmd/run.go 22.22% <0.00%> (-0.64%) ⬇️
internal/boomer/boomer.go 46.42% <0.00%> (-4.89%) ⬇️
internal/boomer/output.go 26.64% <0.00%> (-0.03%) ⬇️
internal/builtin/function.go 1.36% <0.00%> (-0.06%) ⬇️
cli/hrp/cmd/boom.go 38.09% <33.33%> (+0.25%) ⬆️
step.go 44.49% <44.82%> (-0.28%) ⬇️
runner.go 60.58% <71.87%> (+1.44%) ⬆️
convert.go 67.18% <74.50%> (+15.87%) ⬆️
parser.go 86.47% <95.71%> (+1.35%) ⬆️
boomer.go 86.40% <100.00%> (+0.22%) ⬆️
... and 5 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3b9e6cd...af6c433. Read the comment docs.

@xucong053 xucong053 force-pushed the support-api-layer-for-testcase branch from 3c39000 to 649248a Compare March 11, 2022 11:53
}
},
"validate": [
{
"check": "status_code",
"assert": "equals",
"expect": 200,
"expect": 401,
Copy link
Member

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"`
Copy link
Member

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) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1、这里为什么需要忽略大小写?
2、即使需要忽略,在这里处理会导致 mergeSlices 函数有隐藏逻辑

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里再看下上面的评论

Copy link
Collaborator Author

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")
Copy link
Member

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{} {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extract 改回 map[string]string

models.go Show resolved Hide resolved
convert.go Show resolved Hide resolved
internal/builtin/function.go Show resolved Hide resolved
parser.go Show resolved Hide resolved
parser.go Show resolved Hide resolved
@xucong053 xucong053 force-pushed the support-api-layer-for-testcase branch from 6e342d8 to f2b8d76 Compare March 15, 2022 03:26
@xucong053 xucong053 force-pushed the support-api-layer-for-testcase branch from f2b8d76 to af6c433 Compare March 15, 2022 04:45
@xucong053 xucong053 merged commit 4cee7aa into httprunner:main Mar 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants