Hi Bob,
Very easy, I do it all the time:
Use a "Regular Expression Extractor" Post Processor in the page that sends the
value you want. This will set a variable that you can use in your subsequent
POST.
The help and examples on "Regular Expression Extractor" are very good but
something like this should do ya:
Reference Name: enrollment_id
Regular Expression: registration[enrollment_id]" type="hidden"
value="([^"]+?)">
Template: $1$
Match No.: 1
Default Value: enroll_id_NOT_FOUND
Then in your POST wherever you want to pass the value you put ${enrollment_id}
When you test, if the value is replaced by the Default (NOT FOUND) value,
you'll have to adjust the regex appropriately.
Godd luck,
Bruno
-----Original Message-----
From: Bob Nance [mailto:[email protected]]
Sent: Thursday, April 02, 2015 8:41 AM
To: JMeter Users List
Subject: Re: Scripting a new-user signup
Apparently, my mail program encoded the addresses, below and the mailing list
filter displayed the link inline. I have cleared the issue, below.
> On Apr 2, 2015, at 7:17 AM, Bob Nance <[email protected]> wrote:
>
> I have been tasked to create a script that will load-test a sign-up process.
> I have captured the process and need to alter it to create a new user for
> each thread.
>
> I have two issues, one I think I understand how to do, the other, not so much.
>
> 1) The unique email is being handled by a Counter object when the form is
> POSTed. The Counter is referenced as “usercounter” starting at 101,
> incrementing by 1. The username I am posting is:
registration[email] jmeter${usercounter}@bogusemail.com
I am 75% sure that this will do what I want, with each thread using an
incrementing number for its run (the first will sign-up a user named
“[email protected]” and the 10th will sign-up a user named
“[email protected]” )
>
>
> 2) The form, however, passes a hidden variable to the browser that has to be
> passed back in the POST. The number is unique and has to match what was
> handed to it.
>
> <input class="hidden form-control" id="registration_enrollment_id"
> name="registration[enrollment_id]" type="hidden" value="2”>
>
> The developer sent me that snippet. The “value=‘2’ ” is unique for this
> registration and I need to be able to extract that data from the page source
> so that I can pass it back through the thread’s POST. At this point, I am
> LOST! Where do I find this in the recorded transactions? It was obviously
> extracted, since the POST that I sent back in the first test included the
> pair:
>
> registration[enrollment_id] 2
>
> Can anyone provide me a method for pulling the page source information for
> the form so that I can get this unique number? The enrollment fails without
> it and I can’t even test if my ${usercounter} works, either, since I can’t
> see the registration pass with the missing enrollment_id. The registration
> for the first user, the one created during the recording, worked great, since
> my browser handed back the correct number (that time the number was 2214)
>
> I have used jmeter to load-test page loads and form fills, before, but this
> is the first time I have had to manipulate the data. I need help!
>
> -Bob
>