简体   繁体   English

jmeter JSF 和 PrimeFaces 的脚本

[英]jmeter script for JSF with PrimeFaces

I want to stress test JSF application (using Primefaces) with Jmeter and I'm facing a strange problem.我想用 Jmeter 对 JSF 应用程序(使用 Primefaces)进行压力测试,我遇到了一个奇怪的问题。

Said application saves some textual field and one image field.所述应用程序保存一些文本字段和一个图像字段。 The workflow of application is that, on image upload control (primefaces) image is stored in session and on save button click application saves textual data as well as image data (from session).应用程序的工作流程是,在图像上传控件(primefaces)上,图像存储在 session 中,在单击保存按钮时,应用程序保存文本数据和图像数据(来自会话)。

Now the problem is this: I made two post request - one with image data and 2nd with textual data - but the page can't simulate saving.现在的问题是:我提出了两个帖子请求——一个带有图像数据,第二个带有文本数据——但页面无法模拟保存。

Is there any way to simulate the process in jmeter?有什么办法可以模拟jmeter中的过程吗?

Given you send the same requests as browser does you should be able to replicate the browser behaviour, just make sure to:鉴于您发送与浏览器相同的请求,您应该能够复制浏览器行为,只需确保:

  1. Properly build HTTP Request sampler(s)正确构建HTTP 请求采样器
  2. Pay attention to HTTP Headers关注HTTP Headers
  3. Correlate dynamic parameters like JSF ViewState关联动态参数,如JSF ViewState

With regards to point 1 it should be sufficient to just record the requests using JMeter's HTTP(S) Test Script Recorder , just make sure to copy the file(s) you're uploading to the "bin" folder of your JMeter installation, this way JMeter will be able to properly capture the requests.关于第 1 点,使用 JMeter 的HTTP(S) 测试脚本记录器记录请求就足够了,只需确保将要上传的文件复制到 JMeter 安装的“bin”文件夹中,这方式 JMeter 将能够正确捕获请求。 See Recording File Uploads with JMeter article for more details.有关详细信息,请参阅 使用 JMeter 记录文件上传一文。

Points 2 and 3 - cross check the requests which are being sent from browser using browser developer tools and JMeter's View Results Tree listener - the requests need to be exactly the same apart from dynamic parameters which need to be correlated第 2 点和第 3 点 - 使用浏览器开发人员工具和 JMeter 的查看结果树侦听器交叉检查从浏览器发送的请求 - 除了需要关联的动态参数之外,请求需要完全相同

And don't forget to add HTTP Cookie Manager to your Test Plan, it should deal with JSESSIONID and other cookies并且不要忘记将HTTP Cookie Manager添加到您的测试计划中,它应该处理JSESSIONID和其他 cookies

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

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