JMeter WebSocket插件-关闭SignalR连接 [英] JMeter WebSocket plugin - Close SignalR connection

查看:710
本文介绍了JMeter WebSocket插件-关闭SignalR连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个网站使用Asp.NET Core SignalR从服务器动态加载数据.

I've a website using Asp.NET Core SignalR to dynamically load data from the server.

我在此页面上使用JMeter进行功能测试.我使用1.2.1版中的 WebSocket采样器插件来测试SignalR功能.

I use JMeter to do functional tests on this page. I use the WebSocket sampler plugin in version 1.2.1 to test the SignalR functionality.

按照此火焰计指南将JMeter与 WebSocket采样器插件一起使用时,总是会出错关闭SignalR连接.

Following this blazemeter tutorial on how to use JMeter with the WebSocket sampler plugin I get always an error when trying to close the SignalR connection.

我的JMeter采样器设置如下:

My JMeter sampler setup looks like:

  1. WebSocket打开连接
  2. WebSocket请求响应采样器
  3. WebSocket单次读取采样器
  4. WebSocket关闭

为关闭连接,我使用了名为WebSocket Close的WebSocket采样器.该采样器允许提供Close status.

For closing the connection I use the WebSocket sampler called WebSocket Close. This sampler allows to provide a Close status.

我尝试提供不同的Close status代码.但是实际上所提供的代码中的任何一个都没有得到确认,并且总是返回错误消息:

I've tried to provide different Close status codes. But non of the provided codes actually got confirmed and always the error message was returned:

响应代码:WebSocket错误:关闭失败.

Response code: WebSocket error: unsuccesful close.

响应消息:WebSocket错误:收到的不是封闭框架,而是带有文本的文本框架...

Response message: WebSocket error: received not a close frame, but Text frame with text ...

如何在JMeter中正确关闭此连接?

How can I properly close this connection in JMeter?

更新

我发现这取决于我使用多少个采样器.如果我在读采样器之前使用写采样器,则关闭似乎有效.像:

I've figured out that it depends on how many samplers I use. If I use a write sampler before the read sampler the close seems to work. Like:

  1. WebSocket打开连接
  2. WebSocket请求响应采样器
  3. WebSocket单次读取采样器
  4. WebSocket单写采样器
  5. WebSocket关闭

但是,如果我想拥有一个以上的读取采样器,它将不起作用.知道如何正确使用多重读取采样器吗?

But if I want to have more then one read sampler it doesn't work. Any idea how I properly use multiple read sampler?

更新2

我已重新阅读了插件文档,还检查了示例JMeter文件此处. 不幸的是,到目前为止,我还没有找到具有多个Read Samplers的更大样本.

I've re-read the Plugins documentation and also checked the sample JMeter files here. Unfortunately I haven't found a bigger sample with multiple Read Samplers so far.

推荐答案

可能发生的情况是您的服务器发送了一些文本消息,而您的JMeter测试脚本没有读取该消息.这些消息被缓冲,当您关闭WebSocket连接时,关闭采样器"首先读取这些文本消息之一并返回错误.

What probably is happening is that your server has sent some text messages that your JMeter test script hasn't read. These messages are buffered and when you close the WebSocket connection, the "Close Sampler" first reads one of those text messages and returns an error.

有一个更改请求,用于增强"Close Sampler"(关闭采样器)的选项,该选项可以忽略此类缓冲区结束消息.暂时,您可以通过将文本框过滤器与封闭采样器结合使用来实现相同目的;请参阅样本中的使用filter sample.jmx智能关闭"样本目录.

There is a change request for enhancing the "Close Sampler" with an option to ignore such bufferend messages. For the time being, you can achieve the same by combining a text frame filter with the close sampler; see the "Smart close with filter sample.jmx" sample in the samples directory.

这篇关于JMeter WebSocket插件-关闭SignalR连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆