简体   繁体   English

使用加特林时验证响应

[英]Validating response when using Gatling

I'm a complete newbie to Gatling. 我是加特林的新手。 I have a basic Post and Get working to a server and that is working fine. 我有一个基本的Post and Get到服务器上工作,并且工作正常。 What I want to do now is inspect the body of the payload being sent back to make sure it has what I'm expecting. 我现在要做的是检查要发送回的有效载荷的主体,以确保它具有我所期望的。 In particular, in one scenario, I am simply returning a string of 1000 "0" characters. 特别是在一种情况下,我只是返回了一个字符串,其中包含1000个“ 0”字符。 I'd like to check that all 100 characters came back. 我想检查一下是否所有100个字符都回来了。 I also plan to do a database lookup on a server that will return some data in JSON with a known response (let's call it "Fred"). 我还计划在服务器上进行数据库查找,该服务器将以已知响应返回JSON中的一些数据(我们称其为“ Fred”)。 I'd like to do a check that "Fred" is part of the response sent back. 我想检查一下“弗雷德”是否是发送回的响应的一部分。 I looked at assertions, but my understanding is that they are only used for the entire result set - such as checking that all responses were 200, but I may be wrong. 我查看了断言,但是我的理解是它们仅用于整个结果集-例如检查所有响应是否为200,但我可能是错的。

What you're looking for is checks . 您正在寻找的是支票

Then, you really should read the documentation, like the quickstart and the advanced tutorial . 然后,您确实应该阅读文档,例如快速入门高级教程

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM