You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Prateek Dua <pr...@go-mmt.com> on 2018/08/21 13:49:09 UTC

Dynamic Value handling Run Time

Hi,

I'm facing problem in recording a web page where a dynamic value while
submitting login request ( Post request) is getting passed along with login
id & password.

Then I used Post Processor ->Regular expression extractor under that http
request to capture that dynamic value & pass it to same Http request as a
variable.

Hierarchy is Request name ->Regular Expression Extractor

But this approach is not working as instead of real value,  variable name
(as value) is getting passed to Http request.

So here is the config detail for it....

*1. Post request *: http://www.goibibobusiness.com/accounts/login/  ;  *Dynamic
Parameter*: csrfmiddlewaretoken=Kf43kWkuVWGB36WBTiDJEinv78JU8QkY* ( this
value changing at runtime )  ; *

*2. Regular Expression Extractor : Name of created variable:
**csrfmiddlewaretoken
; Regular Expression: value=”([a-zA-Z0-9]+)“  ; Template= $1$ ; Match No.
(0 for Random)=1*

*3. Variable passed as 'Parameter' in above post request       *
*csrfmiddlewaretoken** =**${csrfmiddlewaretoken}*

*4. Parameter generated for same request at run time ( View Result Tree->
Request) *

POST http://www.goibibobusiness.com/accounts/login/

POST data
csrfmiddlewaretoken=%24%7Bcsrfmiddlewaretoken%7D&username=abc@mail.com
&password=password

please help me out here in handling this problem.

-- 


::DISCLAIMER::


----------------------------------------------------------------------------------------------------------------------------------------------------





This message is intended only for the use of the addressee and may 
contain information that is privileged, confidential and exempt from 
disclosure under applicable law. If the reader of this message is not the 
intended recipient, or the employee or agent responsible for delivering the 
message to the intended recipient, you are hereby notified that any 
dissemination, distribution or copying of this communication is strictly 
prohibited. If you have received this e-mail in error, please notify us 
immediately by return e-mail and delete this e-mail and all attachments 
from your system.

Re: Dynamic Value handling Run Time

Posted by Deepak Shetty <sh...@gmail.com>.
Hi
Your Test should look like
+Thread Group
++ HTTP Request (URL = http://www.goibibobusiness.com/accounts/login/ ,
Method = GET)
+++Regex extractor (csrfmiddlewaretoken , regex =
name=['"]csrfmiddlewaretoken['"]\s+value=['"]([^'"]+)['"]) ,
defaultvalue=NOTFOUND
+Debug sampler
++ HTTP Request (URL = , Method=Post)
      Parameter csrfmiddlewaretoken ${csrfmiddlewaretoken} , username,
password etc
++Cookie Manager
++View Results tree (for debugging only)

If you are getting the value literally as ${variableName} it means that
Jmeter didnt find any variable and that you are making some mistake in the
definition or scope or something. Use the debug sampler to see if you
correctly extracted the value
regards
deepak

On Tue, Aug 21, 2018 at 6:49 AM Prateek Dua <pr...@go-mmt.com> wrote:

> Hi,
>
> I'm facing problem in recording a web page where a dynamic value while
> submitting login request ( Post request) is getting passed along with login
> id & password.
>
> Then I used Post Processor ->Regular expression extractor under that http
> request to capture that dynamic value & pass it to same Http request as a
> variable.
>
> Hierarchy is Request name ->Regular Expression Extractor
>
> But this approach is not working as instead of real value,  variable name
> (as value) is getting passed to Http request.
>
> So here is the config detail for it....
>
> *1. Post request *: http://www.goibibobusiness.com/accounts/login/  ;
> *Dynamic
> Parameter*: csrfmiddlewaretoken=Kf43kWkuVWGB36WBTiDJEinv78JU8QkY* ( this
> value changing at runtime )  ; *
>
> *2. Regular Expression Extractor : Name of created variable:
> **csrfmiddlewaretoken
> ; Regular Expression: value=”([a-zA-Z0-9]+)“  ; Template= $1$ ; Match No.
> (0 for Random)=1*
>
> *3. Variable passed as 'Parameter' in above post request       *
> *csrfmiddlewaretoken** =**${csrfmiddlewaretoken}*
>
> *4. Parameter generated for same request at run time ( View Result Tree->
> Request) *
>
> POST http://www.goibibobusiness.com/accounts/login/
>
> POST data
> csrfmiddlewaretoken=%24%7Bcsrfmiddlewaretoken%7D&username=abc@mail.com
> &password=password
>
> please help me out here in handling this problem.
>
> --
>
>
> ::DISCLAIMER::
>
>
>
> ----------------------------------------------------------------------------------------------------------------------------------------------------
>
>
>
>
>
> This message is intended only for the use of the addressee and may
> contain information that is privileged, confidential and exempt from
> disclosure under applicable law. If the reader of this message is not the
> intended recipient, or the employee or agent responsible for delivering
> the
> message to the intended recipient, you are hereby notified that any
> dissemination, distribution or copying of this communication is strictly
> prohibited. If you have received this e-mail in error, please notify us
> immediately by return e-mail and delete this e-mail and all attachments
> from your system.
>