Sent Multiple File Upload Request to Server Jmeter
Overview:
As part of performance testing, I had to come up up with functioning examination scripts for various utilise cases / business workflows for our application. When I design my performance test scripts, I will ensure that I have reusable examination scripts as mentioned in this article.
JMeter – How To Create Reusable & Modular Test Scripts
If you have non read this commodity already, I would request yous to read the article showtime and proceed with this commodity! As part of the above article, you lot can acquire how to properly blueprint your performance exam scripts / examination plan.
In a high level, I maintain a reusable 'examination script' modules under 'Test Fragment'. Then I employ Module Controller to call specific modules to create the workflow.
I likewise create multiple 'Thread Groups' for each business concern functionality / workflow.
Once you lot accept a test plan as mentioned above with multiple thread groups, then let's see how nosotros could maintain the JMeter examination plan using Property files & running a specific thread grouping on a specific environment in this article!
Creating a Simple Exam Programme:
Allow's consider an application with below business functionalities.
- New User Registration
- User Login & Gild Creation
- User Login & Product View
- Existing Lodge Edit/Cancel
- User Search
Lets besides assume that we already came upwardly with functioning test plan with multiple thread groups as shown above. Each thread group will perform the specific functionality.
Sample Operation Test Requirement:
Now Lets presume nosotros have functioning requirements similar,
- Test each module independently (simply run 1 thread group at a time).
- Exam combination of modules (more than than 1 thread group / all).
- Test in different environment (same test in dissimilar surroundings – In my project, I too run the aforementioned test in 2 different environments – QA & Staging).
Parameterizing Environment Details:
- First, lets create different property files containing the test-surroundings details for each environment.
# QA.backdrop examination.environment.hostname=10.eleven.12.fourteen exam.environment.port=8080 test.environment.protocol=http # Staging.backdrop exam.environment.hostname=10.11.12.13 examination.environment.port=443 exam.environment.protocol=https - Now add together a ' Property File Reader ' to read specific environment details at run time.

- Then remove all the Server Proper noun/IP, Port, Protocol details from the HTTP Requests/Samplers in your test plan.
- Allow the HTTP samplers have merely the Path, Parameters, other asking specific information.
- Add a HTTP Request Defaults under Test plan every bit given below.
(If the HTTP request is missing an information, JMeter will get that from HTTP Request Defaults. So, updating IP, port details in 1 place will get reflected for the entire examination).


Annotation:
- ${__P(test.environment.hostname)} will retrieve the value of the ip address or hostname given in the property file.
Now your examination programme is modified to run the script on whatever given test environment.
Parameterizing Thread Group Details:
- We have multiple thread groups in our exam plan.
- We will be passing thread grouping user count, ramp-up period, thread group elapsing information via property files to the test. Lets create a belongings file equally given below.
# Bearding User - Product Search group1.usercount=ten group1.rampup=10 group1.duration=600 # New User Registration group2.usercount=x group2.rampup=10 group2.elapsing=600 # User Login & Order Cosmos group3.usercount=10 group3.rampup=ten group3.elapsing=600 # User Login & Existing Product View group4.usercount=10 group4.rampup=10 group4.duration=600 # BackOffice Admin User Activities - Existing Social club Edit/Cancel group5.usercount=10 group5.rampup=10 group5.duration=600 - All the thread groups should exist modified to use the properties as given below.
- To run 1 specific thread group, we can change the user count (number of users) holding for the Thread Grouping. for ex, If we demand to run only 'New User Registration' module, user count property tin be set to 0 for all other modules.
Note:
If the Thread Grouping user count is 0, JMeter can not execute the Thread Group. By updating thread group user count property to 0, a thread group tin be disabled.
- Lets create a multiple property files with dissimilar combinations every bit y'all might be interested. For ex,anonymoususers-just.propertieswill take below backdrop.
# Anonymous User - Production Search - Only # Bearding User - Production Search group1.usercount=100 group1.rampup=100 group1.duration=3600 # New User Registration group2.usercount=0 group2.rampup=0 group2.elapsing=0 # User Login & Social club Creation group3.usercount=0 group3.rampup=0 group3.duration=0 # User Login & Existing Production View group4.usercount=0 group4.rampup=0 group4.duration=0 # BackOffice Admin User Activities - Existing Order Edit/Abolish group5.usercount=0 group5.rampup=0 group5.duration=0 And then, I create multiple property files to command specific thread group execution.
- registration-just.properties
- ordercreation-only.properties
- all-modules.properties..etc
Add one more than 'Holding File Reader' to read specific module you are interested in executing.

Controlling Thread Group & Environment via Control Line:
- At this point, We have created a JMeter test plan equally explained in a higher place with 2 Property File Readers.
- Now, lets parameterize the surround and module using properties which I will pass via control line at run time.

Rest is simple!!!
- To run all modules on Staging environment
jmeter -n -t test.jmx -50 result.jtl -Jenvionment=staging -Jmodule=all-module - To run all modules on QA environment,
jmeter -northward -t examination.jmx -l result.jtl -Jenvionment=QA -Jmodule=all-module - To run order creation module on Staging,
jmeter -due north -t examination.jmx -l result.jtl -Jenvionment=staging -Jmodule=ordercreation-only To run registration module on QA,
jmeter -n -t examination.jmx -l outcome.jtl -Jenvionment=QA -Jmodule=registration-merely Triggering Thread Groups via Jenkins:
If we employ Jenkins to run our test, these test surround & module tin be drib down list containing the possible values & passed as parameters from Jenkins to JMeter.
Thus, We tin run specific thread group on specific surroundings without modifying the JMeter test as given below.
More details on JMeter-Jenkins integration tin can be found hither .
Summary:
By properly designing the JMeter test plan with reusable test scripts, multiple thread groups and Property File Reader etc, nosotros are able to control specific thread grouping execution at run time.
So we can focus on operation related issues for a specific module instead of running the whole examination plan every time.
Happy Testing & Subscribe 🙂
Source: https://www.vinsguru.com/jmeter-manage-test-plan/
0 Response to "Sent Multiple File Upload Request to Server Jmeter"
Postar um comentário