简体   繁体   English

JMeter使用WebSocket连接测试身份验证

[英]JMeter testing authentication with WebSocket connection

I have testing my application (this only back end) in Jmeter. 我已经在Jmeter中测试了我的应用程序(这只是后端)。 I doing functional test in JMeter. 我在JMeter中进行功能测试。 Now I want to testing authorization. 现在我要测试授权。 My authorization is following: open WebSocket connection and then send JSON.stringify as KeyService. 我的授权如下:打开WebSocket连接,然后将JSON.stringify作为KeyService发送。

What I can testing in JMeter this? 我可以在JMeter中测试什么? I think first added to ThreadGroup in Test Plan - WebSocket Open Connection and set Server name and port,. 我认为首先在测试计划中添加到ThreadGroup-WebSocket打开连接并设置服务器名称和端口。 next WebSocket P{ing/Pong, next WebSocket Single Write Sample - and this in Request data I think written as sstring format Key so for example "1234566788" which is in json format. 下一个WebSocket P {ing / Pong,下一个WebSocket单一写入示例-这个在请求数据中,我认为是以sstring格式键编写的,例如json格式的“ 1234566788”。 and next added WebSocket Single Read Sampler? 然后添加WebSocket单一读取采样器?

Is it correctly doing test? 测试正确吗? what else add? 还有什么补充? maybe I should add Json Extractor (or something other?) and in this written content json.stringify file ? 也许我应该在此书面内容json.stringify文件中添加Json Extractor(或其他?)? how is it the best way to tested this in JMeter? 如何在JMeter中对此进行测试的最佳方法?

The best way to test something with JMeter in particular or load test anything in general is to put it under anticipated load and make sure that each JMeter thread (virtual user) performs exactly the same actions as real user (or application) would do . 尤其是使用JMeter进行测试或对所有内容进行负载测试的最佳方法是将其置于预期的负载下, 并确保每个JMeter线程(虚拟用户)执行的操作与真实用户(或应用程序)执行的操作完全相同

In other words, well-behaved load test must represent system under test real-life usage as close as possible, better with 100% accuracy, otherwise such test will not make a lot of sense. 换句话说,行为良好的负载测试必须尽可能接近地代表被测系统的实际使用情况,更好地以100%的精度表示,否则这种测试就没有多大意义。

The general recommendation is recording the traffic between system under test and "consumer" - browser, application, other server using a sniffer tool like Wireshark and then re-create the same traffic using JMeter so requests would be exactly the same (apart from dynamic parameters which need to be correlated ) 一般建议是使用诸如Wireshark的嗅探器工具记录被测系统和“消费者”之间的流量-浏览器,应用程序和其他服务器,然后使用JMeter重新创建相同的流量,因此请求将完全相同 (除了动态参数外)需要关联的

In your case if the test scenario is about logging in you might want to verify whether you're really got logged in after sending a corresponding request(s), you can use Response Assertion in order to check response code, message and/or body and conditionally fail the sampler if response contains the data it shouldn't (or does not contain the data it should) 在您的情况下,如果测试场景是关于登录的,则您可能希望在发送相应的请求后验证您是否真正登录,可以使用Response Assertion来检查响应代码,消息和/或正文。并且如果响应包含不应包含的数据(或不包含应包含的数据),则有条件使采样器失败

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

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