开发运行环境:JMeter 2.9 + JDeveloper 11.1.2.4
右键Thread Group -> Add Config Element -> User Defined Variables
右键Thread Group -> Add Post Processors -> Regular Expression Extractor
3. 记录请求脚本
详细步骤请参考《JMeter_001:压力测试指南之一:基本功能》。
4. 修改请求脚本,替换变量
(1)把URL Path中的参数值设为之前定义好的ADF Variables。
(2)把Parameters中的参数值设为之前定义好的ADF Variables。
比如:
5. 运行压力测试
6. 遗留问题
(1)发现Parameters种有_afrRedirect参数,不知道是否需要设置,我没有设置,测试也通过了。
(2)请求/StoreFrontModule/faces/adf.login-success中有个_afrLoop参数,我设置其值为${afrLoop}后,测试不通过,会报出 Internal 500错误:
Error-page location: "/faces/unexpectedErrorHandler.jspx" for the error-code: "500" causes an infinite loop condition as it throws the same code for which it has been mapped.
参考文献:
1. https://blogs.oracle.com/onesizedoesntfitall/entry/new_recording_on_using_jmeter
2. http://one-size-doesnt-fit-all.blogspot.com/2010/04/configuring-apache-jmeter-specifically.html
与普通Web应用不同,ADF Web应用中有很多状态需要保持,因此需要做些额外的设置。
本文以Fusion Order Demo为例,来说明如何使用JMeter测试ADF Web应用。
1. 测试场景
访问FOD应用主页,购买一些商品后,选择Check Out,输入账户信息登录,确认提交,登出。
2. JMeter设置
(1)增加 HTTP Cookie Manager
右键Thread Group -> Add Config Element -> HTTP Cookie Manager,勾上" Clear cookies each iteration?"
(2)增加 User Defined Variables,这些变量就是ADF Web应用中要保持的状态变量右键Thread Group -> Add Config Element -> User Defined Variables
- afrLoop
- afrWindowId
- jsessionId
- adf.ctrl-state
- javax.faces.ViewState
右键Thread Group -> Add Post Processors -> Regular Expression Extractor
Name: | adf.ctrl-state Extractor |
Response Field to Check: | Body |
Reference Name: | adf.ctrl-state |
Regular Expression: | _adf.ctrl-state=([-_0-9A-Za-z!]{10,13}) |
Template: | $1$ |
Match No.: | 1 |
Default Value: |
Name: | afrLoop Extractor |
Response Field to Check: | Body |
Reference Name: | afrLoop |
Regular Expression: | _afrLoop=([-_0-9A-Za-z]{13,16}) |
Template: | $1$ |
Match No.: | 1 |
Default Value: |
Name: | afrWindowId Extractor |
Response Field to Check: | Body |
Reference Name: | afrWindowId |
Regular Expression: | window.name='([-_0-9A-Za-z!]{10,13})' |
Template: | $1$ |
Match No.: | 1 |
Default Value: |
Name: | javax.faces.ViewState Extractor |
Response Field to Check: | Body |
Reference Name: | javax.faces.ViewState |
Regular Expression: | |
Template: | $1$ |
Match No.: | 1 |
Default Value: |
Name: | jsesssionId Extractor |
Response Field to Check: | Body |
Reference Name: | jsessionId |
Regular Expression: | ;jsessionid=([-_0-9A-Za-z!]{63}) |
Template: | $1$ |
Match No.: | 1 |
Default Value: |
3. 记录请求脚本
详细步骤请参考《JMeter_001:压力测试指南之一:基本功能》。
4. 修改请求脚本,替换变量
(1)把URL Path中的参数值设为之前定义好的ADF Variables。
(2)把Parameters中的参数值设为之前定义好的ADF Variables。
比如:
5. 运行压力测试
6. 遗留问题
(1)发现Parameters种有_afrRedirect参数,不知道是否需要设置,我没有设置,测试也通过了。
(2)请求/StoreFrontModule/faces/adf.login-success中有个_afrLoop参数,我设置其值为${afrLoop}后,测试不通过,会报出 Internal 500错误:
Error-page location: "/faces/unexpectedErrorHandler.jspx" for the error-code: "500" causes an infinite loop condition as it throws the same code for which it has been mapped.
Project 下载:FusionOrderDemo.jmx
参考文献:
1. https://blogs.oracle.com/onesizedoesntfitall/entry/new_recording_on_using_jmeter
2. http://one-size-doesnt-fit-all.blogspot.com/2010/04/configuring-apache-jmeter-specifically.html
没有评论:
发表评论