Reputation: 1628
I'm very new to JMeter and that's my task:
I have some .xml files i intend to use as consecutive SOAP/XML Requests to a WebService in a single Test.
Thanks in advance
Upvotes: 1
Views: 2020
Reputation: 168147
I guess that you can use Module Controller to avoid samplers duplication.
In regards to reading xml file names, you can use Beanshell Sampler to load files into variables and ForEach Controller to iterate through them. Example Beanshell code to store file names in a directory into variables will look as follows:
import java.io.File;
File xmldir = new File("/path/to/your/directory");
{
int counter = 1;
for (File xmlfile : xmldir.listFiles())
{
if (xmlfile.getName().endsWith(".xml"))
{
vars.put("xmlfile_" + counter, xmlfile.getCanonicalPath());
counter++;
}
}
}
It'll produce variables like:
xmlfile_1 = test1.xml
xmlfile_2 = test2.xml
xmlfile_N = testN.xml
etc.
which you will be able to iterate via ForEach Controller configured as follows:
xmlfile
currentfile
So you should be able to refer your XML files as ${currentfile}
or ${__V(currentfile)}
in your SOAP requests.
Upvotes: 2