我正在使用jmeter测试asp.net web应用程序。 我正在关联动态变量,但我在获取变量的值时遇到了问题" Guid"。 首先,我知道第一次被GET方法请求并使用我发现的GET参数(查询字符串)中的嗅探器,第二次是通过GET也是如此,但是被网址发送,就像那样:
"request": {
"method": "GET",
"url": "http://srvdr.ajk.fye:27080/Art/WebP/Wep.aspx?Title=Procesar%20Instancia%20Actividad&CodigoProducto=1010102&CodigoProceso=CONST&CodigoActividad=1413&AK=12345&FechaInicio=03/02/2015%2004:01:56%20p.m.&mnu=999&Guid=64a42d6e6e2f45afb4905e82b5eddacf&SessionId=puucb42xfmgph2ggmhzrurlm044339",
我试图使用以下方式捕获它:
1-首先是这样的CSS / JQuery Extractor:
Reference Name: varGuid
CSS/JQuery expression: #Guid
Attribute: value
Match No (0 for Random): 0
Default value:
没有工作......
2-其次我尝试使用这样的RegExp:
Reference Name: varGuid
Regular Expression: Guid=(.+?)&
Template: $1$
Match No (0 for Random): 0
Default value:
但是没有抓到任何东西,我不知道还能做什么...... 请有人帮助我!
... UPDATING 错误:
java.net.URISyntaxException: Illegal character in query at index 268: http://srvdr.ajk.fye:27080/Art/WebP/Wep.aspx?Title=Procesar%20Instancia%20Actividad&CodigoProducto=1010102&CodigoProceso=CONST&CodigoActividad=1098&AK=673509&FechaInicio=24/01/2015%2012:58:56%20p.m.&ValidarPerfilAgencia=True&mnu=999&Guid=${varGuid}&SessionId=op5bra3jre2mrcvb10m04qy1093246
at java.net.URI$Parser.fail(Unknown Source)
at java.net.URI$Parser.checkChars(Unknown Source)
at java.net.URI$Parser.parseHierarchical(Unknown Source)
at java.net.URI$Parser.parse(Unknown Source)
at java.net.URI.<init>(Unknown Source)
at java.net.URL.toURI(Unknown Source)
at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:283)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:74)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1141)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1130)
at org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:431)
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:258)
at java.lang.Thread.run(Unknown Source)
使用测试计划结构进行更新
Test Plan
User Defined Variables
HTTP Request Defaults
HTTP Cookie Manager
Thread Group
Recording Controler
Transaction Controller
HTTP REQUEST name: 30/Art/WebL/wfmLoginD.aspx
CSS/JQuerySessionId
Transaction Controller
HTTP REQUEST name: 31/Art/WebL/wfmL.aspx
Transaction Controller
HTTP REQUEST name: 32/Art/WebL/wfmL.aspx (In this request is comming the Guid as the GET parameters)
RegularExpressionGuid
Transaction Controller
HTTP REQUEST name: 33 /Art/WebL/wfmL.aspx?Title=Procesar+Instancia+Actividad&CodigoProducto=1010102&CodigoProceso=CONST&CodigoActividad=1098&AK=${idAK}&FechaInicio=24%2f01%2f2015+12%3a58%3a56+p.m.&ValidarPerfilAgencia=True&mnu=999&Guid=${varGuid}&SessionId=${sessionid}
Debug Sampler
View Results Tree
WorkBench
HTTP(S) Test Script Recorder
在树视图结果中: 请求32发送此错误:
GET http://srv/Art/WebL/wfmL.aspx?Title=Procesar%20Instancia%20Actividad&CodigoProducto=1010102&CodigoProceso=CONST&CodigoActividad=1098&AK=673509&FechaInicio=24/01/2015%2012:58:56%20p.m.&ValidarPerfilAgencia=True&mnu=999&Guid=${varGuid}&SessionId=55byogbbybhrhorbebiqudrm030702
[no cookies]
32的反应是:
java.net.URISyntaxException: Illegal character in query at index 268: http://srv/Art/WebL/wfmL.aspx?Title=Procesar%20Instancia%20Actividad&CodigoProducto=1010102&CodigoProceso=CONST&CodigoActividad=1098&AK=673509&FechaInicio=24/01/2015%2012:58:56%20p.m.&ValidarPerfilAgencia=True&mnu=999&Guid=${varGuid}&SessionId=55byogbbybhrhorbebiqudrm030702
at java.net.URI$Parser.fail(Unknown Source)
at java.net.URI$Parser.checkChars(Unknown Source)
at java.net.URI$Parser.parseHierarchical(Unknown Source)
at java.net.URI$Parser.parse(Unknown Source)
at java.net.URI.<init>(Unknown Source)
at java.net.URL.toURI(Unknown Source)
at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:283)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:74)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1141)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1130)
at org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:431)
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:258)
at java.lang.Thread.run(Unknown Source)
并且在请求33中出现此错误,此处Guid正在获取值&#34; h&#34;我不明白这里发生了什么
POST http://srv/Art/WebL/wfmL.aspx?Title=Procesar+Instancia+Actividad&CodigoProducto=1010102&CodigoProceso=CONST&CodigoActividad=1098&AK=673509&FechaInicio=24%2f01%2f2015+12%3a58%3a56+p.m.&ValidarPerfilAgencia=True&mnu=999&Guid=h&SessionId=55byogbbybhrhorbebiqudrm030702
POST data:
rsmScriptManager_TSM=%3B%3BSystem.Web.Extensions%2C+Version%3D4.0.0.0%2C+Culture%3Dneutral%2C+PublicKeyToken%3D31bf3856ad364e35%3Aes-PE%3A509f92a1-e5fd-464f-a450-13846a6c973b%3Aea597d4b%3Ab25378d2%3BTelerik.Web.UI%2C+Version%3D2012.3.1308.40%2C+Culture%3Dneutral%2C+PublicKeyToken%3D121fae78165ba3d4%3Aes-PE%3A0c62baaa-fecc-4eb5-91ff-e3de59bf8f40%3A16e4e7cd%3Aed16cbdc%3Af7645509%3A24ee1bba%3A7165f74%3Ae330518b%3A1e771326%3A8e6f0d33%3A6a6d718d%3A8674cba1%3A7c926187%3Ab7778d6c%3Ac08e9f8a%3Aa51ee93e%3A59462f1%3A874f8ea2%3Af46195d3%3A19620875%3A490a9d4e%3Abd8f85e4%3Aa7e79140&__EVENTTARGET=btnIr&__EVENTARGUMENT=&__LASTFOCUS=&__VIEWSTATE=%2FwEPDwULLTE2MTY2ODcyMjlkZHo6ihSMfi3%2Bb2BIYPR7%2Bt5A2g4O&__VIEWSTATEGENERATOR=089A3467&__SCROLLPOSITIONX=0&__SCROLLPOSITIONY=0&__EVENTVALIDATION=%2FwEdAATZZXM7aurrhLYJ0ij%2B03LaYhM0SpqGl6sQ9WQzHF7zLq7ad8Q7AL0pZvZlvE%2BM6yw6acSb565lrI%2B%2FgO9Y5T%2F8b%2BlKMjTlmm0duBT2lHLkrxDZFZg%3D&txtSalir=NO&HiddenField1
答案 0 :(得分:0)
如果您的GUID值为URL CSS / JQuery提取器赢得了很多帮助。
有关每个配置字段的详细说明,请参阅Using RegEx (Regular Expression Extractor) with JMeter指南。
除了这两点之外,你的正则表达式配置看起来还不错。