How can i upload different files per thread in jmeter - jmeter

I can currently upload a file to a web service using a POST and path of the files.
JMeter 2.13
When running the tests with 1 thread it uploads all the files in the directory to the web service. If I run it with 2 threads it uploads all the files twice.
I want to be able to send x amount random files per thread but don't want to send the same files again.
Any advice on how I can do this without using a CSV file?

I can see at least 2 possible solutions:
Using HTTP Simple Table Server plugin. It has KEEP=FALSE option so the file will be removed from the list after uploading. You can install HTTP Simple Table Server using JMeter Plugins Manager
Use the following approach:
in setUp Thread Group use JSR223 Sampler to copy folder with your test files into a temporary location, the relevant Groovy code will be something like:
org.apache.commons.io.FileUtils.copyDirectoryToDirectory(new File('/path/to/source/folder'), new File('/path/to/destination/folder'))
after file upload request you can delete the file which has already been used in the JSR223 PostProcessor like:
new File('/path/to/the/file').delete()

Related

how to let Jmeter add test files as part of the load test

My application is about uploading files and converting them.
How do I add those test files as part of the load test?
Is that by using variable and parameter?
Please share with me samples if there is.
The easiest way of building a JMeter Test Plan is recording the requests using your browser and JMEter's HTTP(S) Test Script Recorder
In order to be able to record the file upload event you need to copy the file(s) you will be uploading to "bin" folder of your JMeter installation. See Recording File Uploads with JMeter guide for more details if needed.
Once you have test plan "skeleton" you will be able to parameterize file names/correlate dynamic parameters/etc.

Is there a way to stock automatically jmeter results in nexus repository?

I am new to jmeter and i am trying to find a way to save all jmeter results in nexus repository so i can be able to compare previous results to the current results.
Does anyone have an idea ?
Thanks in advance.
Looking into How can I programmatically upload files into Nexus 3? article it's a matter of a single simple HTTP Request
Configure JMeter to flush the results into the .jtl file as soon as they're available by adding the next line to user.properties file
jmeter.save.saveservice.autoflush=true
Add tearDown Thread Group to your Test Plan
Add HTTP Request sampler to the tearDown Thread Group and configure it to upload the .jtl results file to Nexus repository:
You might also need to add HTTP Authorization Manager in order to provide Nexus credentials
You can also use Merge Results JMeter Plugin which has possibility to compare up to 4 .jtl results files.

JMeter - Multiple users reading requests from a directory

I have a directory of XML files, and I wanted to configure Jmeter such a way that multiple users(threads) should be able to read the XML files(SOAP requests) concurrently (in a round-robin way or some other way) and submit them to Web Service Endpoint, which means I wanted them to share the input files.. for example if my directory contains 100 XML files then all of my configured users(threads) should share the load and jointly have to process the XML files. (Each user should not process all the 100 files independently).
Is there any way to test the above scenario?
Thanks,
Siva
I believe Directory Listing Config plugin would be the easiest option to use
Just provide path to the directory where your XML files live, configure the plugin according to your test scenario and that's it, you will be able to use just one HTTP Request sampler and refer the file name (or path) as ${filename} where required.
You can install Directory Listing Config plugin and keep it up-to-date via JMeter Plugins Manager.

SMTP Sampler executes receives IOExeception while sending message

I'm using jmeter 3.2, I want run a SMTP Sampler in Jmeter where I have done the necessary configuration by adding the javamail file in the lib folder of Jmeter and adding necessary credentials in the mail setting, though when executed I am getting an error of IOException.
Am I missing any step?
There was a change in SMTP Sampler in jmeter 3.2 which created several bugs.
You open a bug to jmeter with a sample if it's a different scenario.
If you can downgrade to Jmeter 3.1 if it can work.
EDIT
You can download a fix to the issue in jmeter-3.3
If you are trying to send a file as an attachment you have 2 options:
If you are using relative path (just filename) make sure you put the file into JMeter's "bin" folder. So JMeter could find it. Check out jmeter.log file to know where JMeter is expecting the file to be.
Use full path (like c:\somefolder\someotherfolder\somefile.eml)
In case if you still experience the problem update your question with your email server configuration and jmeter.log file contents. In the meantime check out Load Testing Your Email Server: How to Send and Receive E-mails with JMeter article

JMeter & Mule load testing for file to file test

Is there a way to use JMeter to load test file to file inbound-outbound endpoints in mule? New to JMeter. Does JMeter have this capability or should I look to another framework to do file to file load testing?
I have accomplished this kind of load test before using JUnit and the Mule FunctionalTestCase. I simply create the files I need on my local filesystem under the target/ directory of the Mule application, and observe an output folder also under target/.
This allows me to understand the behavior of the mule application independent of other factors such as disk I/O contention on the server.
To the best of my knowledge, neither JMeter nor LoadUI offers a feature that would allow you to generate large numbers of files, nor to monitor for the output of files.

Resources