Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

并发测试如何记录返回结果 #372

Open
YRXING opened this issue Jun 19, 2023 · 4 comments
Open

并发测试如何记录返回结果 #372

YRXING opened this issue Jun 19, 2023 · 4 comments

Comments

@YRXING
Copy link

YRXING commented Jun 19, 2023

General Question

我想在自定义并发测试的Loop中BindJSON,但是好像没有数据

	createResp := api_model.CreateObjRespData{} // 响应体
	logs.Infof("Begin  benchmark....")
	Ids = make([]string, C.Number)
	filter.NewBench().
		Concurrent(C.Concurrent).Number(C.Number).
		Loop(func(c *dataflow.Context) error {
			c.GET(C.Url + "/api/v1/CreateObj").
				SetQuery(NewCreateObjReq()).SetHeader(gout.H{
				"x-jwt-token": token,
			}).BindJSON(&createResp)
			logs.Infof("createResp %+v", createResp) // 打印位置1
		        Ids = append(Ids, createResp.Id)
			return nil
		}).Do()
	logs.Infof("Resp----%+v", createResp) // 打印位置2

示例代码如上,我想把请求返回的数据ID记录下来,不管是在位置1还是位置2都是空的,哪怕我在Loop函数里面执行c.Get.Do()也不行。

@YRXING
Copy link
Author

YRXING commented Jun 19, 2023

@guonaihong

@guonaihong
Copy link
Owner

@YRXING ok我看下。

@guonaihong
Copy link
Owner

看了下现有实现,目前压测模式只支持编码器(SetXXX系列的函数), 不支持解码器(BindXXX系列函数), 不过这个需求我想想,看怎么实现。

@YRXING
Copy link
Author

YRXING commented Jun 19, 2023

OK,可以顺便也考虑下这个需求:压测的结果如果有选项能输出到文件或者其他格式html,csv,像ghz那样

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants