jmeter - Is it possible to duplicate value of a form input - jmeter

I'm using jmeter to make a POST request (submit a form). I have email and confirm email fields which must be identical. If I generate a random email address for the "Email" field, how can I use it for the "Confirm Email" field? This is the function for the random email address:
${__RandomString(${__Random(3,9,)},abcdefghijklmnopqrstuvwxyz,)}#${__RandomString(${__Random(2,3,)},abcdefghijklmnopqrstuvwxyz,)}.${__RandomString(${__Random(2,3,)},abcdefghijklmnopqrstuvwxyz,)}

You can use i.e. Set Variables Action to create a variable, i.e. email before you will use it the first time:
Once done you will be able to refer the generated value as ${email} where required:
Set Variables Action plugin can be installed using JMeter Plugins Manager

Related

How to add php script to forward a copy of a form

Currently using Joomlashine JSN Uniforms on a beta site. I need to send a duplicate submission to another email address. However, JSN Uniforms canot do this ATM, but there is Script section in form admin panel which includes
Custom Scripts (PHP) called on form processing
The $html string contains the HTML code of the form. You can modify it by adding a PHP script below. Remember to not include the tags.
On form Process
The $post variable contains $_POST data of the form. You can modify it by adding a PHP script below, before it is added to the database. Remember to not include the tags.
After form has been processed
The $post variable contains $_POST data of the form. You can modify it by adding a PHP script below, after form been processed successfully. Remember to not include the tags.
Form Setup
Name
email
subject
department (pulldown) 1. Sales & Service 2. Training & Standards
Message
send
Department: Sales & Service has 2 email addresses (at the moment Uniforms can only assign 1 email address
user1#company.com
user2#companny.com
is there a script I can use to have the submitted form send to the Department user2#company.com and have the form sent to user1#company.com
problem resolved by not messing around with Joomla but adjusting the email service to forward/alias to one address and simply setup Outlook client for each use for the primary email address

How can I reuse dynamic email to another request in jmeter

There is a form with email validation, once you enter email, it will check if the same email existing or not followed by submiting the form.
I want to know how can I use the same email to next request.
Add a Regular Expression Extractor, choose Field to check as Request Headers
and use Regular expression to match headers in request as email: mymail#mydomain.com
email: ([^\t\n]+)
Just provide a JMeter Variable name of your choice as the 3rd parameter for the __Random() function like:
${__Random(10000000,99999999,randomNumber)}
this way JMeter will generate a random number and store it into ${randomNumber} JMeter Variable which you will be able to reuse later on where required:
More information: Using JMeter Functions - Part II

How to deal with dynamic parameter name in JMeter

Login page is having dynamic password field name: every time user visits the login page field name looks like PASSWORD_673834937, and on next visit, it looks like PASSWORD_673857943.
I have created many scripts which were working as of today, but in latest build they bring in this change to the password field... before this it was always PASSWORD only. So all my scripts were failing. What is the workaround, so that all my scripts start working with dynamic field name?
OLD JMETER SCRIPT using name as "PASSWORD"
NEW changes to the password field
Under register.asp sampler, add RegEx Post-Processor
Specify the following parameters:
(i.e. the regular expression is <input TYPE="password" NAME="([^"]+)")
In HTTP Request, in the row where password is provided, specify variable created by RegEx Post-Processor in Field name, instead of static name. For example, since the variable I created above is called PasswordFieldName, the HTTP Sampler should look like this (omitting irrelevant parameters):
This is a matter of missing correlation, you would need this sooner or later given you continue playing with JMeter.
The idea of bypassing dynamic parameters is building your Test Plan as follows:
Request 1 (open login page)
Extract dynamic parameters and store them into JMeter Variables
Request 2 (perform login) providing credentials and all dynamic variables from the previous step
Add CSS/JQuery Extractor (be aware that it is not recommended to use regular expressions to work with HTML data) as a child of the register.asp page and configure it as follows:
Reference Name: anything meaningful, i.e. name
CSS/JQuery Expression: input[title=Password]
Attribute: name
Replace PASSWORD_673834937 with ${name} in the new script.

How to pass parameters in Jmeter for username and login.?

I have just been assigned the tasks of doing some research and doing some JMeter tests for performance testing. As I have never used this tool before.!
I just added the IP or address of my project, in that screen there is two textbox for username and password lets say its id are User1 / Pass1. I'm having several authenticate credentials to check. so how can i parameter those from an external sheet.?
The most popular approach to provide external data to parametrize JMeter tests is Using CSV DATA SET CONFIG
You can also use User Parameter Pre-processor.
You can add variable with name value pair in this pre-processor.
For e.g. :
name : id value : abc
name : pwd value : xyz
you can then refer these variables in your samplers as ${id} & ${pwd}
Also you can increase the users count just by adding more users.
See below image for more details.

JMeter - how to simulate an email address AND a confirm email address

I'm trying to setup a JMeter test plan and need to create unique email addresses for submission. I saw this that suggested using the Random Function.
The problem is that I need to generate an email address AND reference that same created email in the confirm_email field. I need to randomly generate an email address and then use it twice. How do I do that?
Thanks.
I learned that there's an extra parameter to the __Random function that can hold a variable name that you can reference later.
So, my Parameters are:
email : ${__Random(1,10000000,refName)}#jmeter.com
email 2 : ${refName}#jmeter.com
Voila!

Resources