java 使用 JMeter 测试 JSF 应用程序 - ViewState 问题

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12734017/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 10:00:44  来源:igfitidea点击:

Testing JSF application with JMeter - ViewState issue

javajsfviewstatejmeterload-testing

提问by LancerX

All day I try to run JMeter tests of my JSF application. I am aware of ViewState, but it seemed to be quite simple issue. I prepared Regular Expression Extractor:

我整天都在尝试对我的 JSF 应用程序运行 JMeter 测试。我知道ViewState,但这似乎是一个很简单的问题。我准备了正则表达式提取器:

Reference Name: jsfViewState
Regular expression: id=\"javax.faces.ViewState\" value=\"(.+?)\"
Template $
Match No. 1

Regular Exp Extractor

常规 Exp 提取器

The following samplers are created with proxy and recording.

以下采样器是使用代理和录音创建的。

First request /TourJSF/pages/protected/admin/addTourPage.xhtml. This is GETrequest from which ViewState will be extracted.

第一个请求/TourJSF/pages/protected/admin/addTourPage.xhtml。这是GET从中提取 ViewState 的请求。

First GET

首先获取

The POSTrequest /TourJSF/pages/protected/admin/addTourPage.xhtmlwhere .${jsfViewStete}is passed into javax.faces.ViewState

POST请求/TourJSF/pages/protected/admin/addTourPage.xhtml在哪里。${jsfViewStete}被传入javax.faces.ViewState

jsfViewState passed

jsfViewState 已通过

The second GETrequest, now very important in this case.

第二个GET请求,现在在这种情况下非常重要。

Second GET

第二次获取

The results:

结果:

First GET. On the right we can see value of ViewState.

首先GET。在右侧我们可以看到 ViewState 的值。

first GET result

第一个 GET 结果

Debug Samplerwhich shows that jsfViewState value is correct. We can compare it with the previous screen.

Debug Sampler这表明 jsfViewState 值是正确的。我们可以将其与之前的屏幕进行比较。

Debug Sampler

调试采样器

javax.faces.application.ViewExpiredException: viewId:/pages/protected/admin/addTourPage.xhtml - View /pages/protected/admin/addTourPage.xhtml could not be restored.

ViewExpiredException addTourPage.xhtml could not be restored

ViewExpiredException addTourPage.xhtml 无法恢复

I found some blogs and topics about this issue but many of them were unsolved. If it is needed I can put links to these topics. I am really confused...

我找到了一些关于这个问题的博客和主题,但其中许多都没有解决。如果需要,我可以放置这些主题的链接。我真的很困惑...

Where is the issue? Maybe something with

问题出在哪里?也许有些东西

  • jsessionid?
  • HTTP Header Managerin every HTTP Request? I deleted HTTP Header Managerbut nothing changed.
  • something with JSF apllication? When I added context-param com.sun.faces.enableRestoreView11Compatibilityinto web.xml, there was no ViewExpiredExceptionbut the content of returned page was not correct.
  • jsessionid?
  • HTTP Header Manager在每个HTTP Request? 我删除了HTTP Header Manager但没有任何改变。
  • JSF 应用程序的东西?当我将 context-param 添加com.sun.faces.enableRestoreView11Compatibility到 中时web.xml,没有ViewExpiredException但返回页面的内容不正确。