I am primarily using JMeter -CSV_Data_Config element to bind csv data with a XML template as shown below.
This works beautifully when the data in the excel cells are static ie.. know set of columns. eg. 6 cols in csv file bind to 6 variables in XML file.
Lets say end user decides to have 15 cells of data in the csv file. Can i make the jMeter script dynamic to add new XML elements eg.Item with new attributes based on the number of cells in the csv file ?
I think a beanShell script might help if not ? not sure how .. any help -much appreciated !
Personally I would use the following approach for getting data from CSV file with unknown number of columns:
User Defined Variables (defined variable N with the value of 0)
While Controller
Counter (Start: 1, Increment: 1, Reference Name: N)
Samplers with data-driven logic
and use the following line as condition for the While Controller
${__javaScript("${__CSVRead(/path/to/your/file.csv,${N})}"!="",)}
See __CSVRead() function documentation for more details.
Related
I have a .csv data file with data like:
Row-1: A
Row-2: B
Row-3: C
When I run the script with 1 user 3 iterations, it is taking the same value A for all 3 iterations. What do I need to do if I would like to use value A for iteration-1 and value B for iteration-2 & etc.? It did not make any difference between placing the data file inside the thread group or outside the thread group.
Please could someone help?
Thanks,
N
In current form your question cannot be answered comprehensively, the missing bits are:
What test element/function do you use for reading the values from the CSV file. The recommended option is CSV Data Set Config
What controller is used for creating the "iterations"
CSV Data Set Config needs to be placed inside that controller
Sharing mode of the CSV Data Set Config needs to be set to "All Threads"
fProcessor.process() method stuck when PDF template with two repeating groups on same page is used.
Is it possible to use two or more repeating groups (not nested) on same page?
FormProcessor fProcessor = new FormProcessor();
fProcessor.setTemplate(args[0]); // Input File (PDF) name
fProcessor.setData(args[1]); // Input XML data file name
fProcessor.setOutput(args[2]); // Output File (PDF) name
fProcessor.process();
Received following reply from oracle support
PDF templates do not support multiple nor nested loops.
You can only use one.
I have a script in which I filter the data in a module by a certain attribute value. When I then loop through these objects, for now, I am displaying the absolute number of the objects in an infoBox. However, the script is displaying absolute numbers of objects that are not in the dataset. Upon further investigation, I found that the extra absolute numbers were for each table within the entire module. I can't figure out why the script would include these tables when they are not in the filtered module data. I have even tried manually filtering the module on this attribute value then use the "Tools -> Edit DXL" to loop through the resulting items and it still displays the numbers for the tables that are not included. Why would it do this?
Here's my code:
bm2 = moduleVar
Filter fltr = contains(attribute "RCR_numbers", sRCRNum, false);
filtering on;
set(bm2, fltr);
for oObj in document(bm2) do {
absNum = oObj."Absolute Number";
infoBox("Object #" absNum ".");
}
I have also tried removing the document cast so it says "for oObj in bm2 do" instead, but this doesn't change the output. Why is the code giving me objects that are not in the filter? Any help would be greatly appreciated since this is a high priority issue for my project and I'm out of ideas myself.
Chris
In the DOORS 9.6.1 DXL Reference Manual you can see that:
for object in document
Assigns the variable o to be each successive
object in module. It is equivalent to the for object in module loop,
except that it includes table header objects, but not the row header
objects nor cells.
So, you must either use for object in module or, within your existing loop, test the hidden attribute TableType - this will be set to TableNone for anything that is not part of a table, table headers included.
I have a folder where many files containing different SOAP requests. I want to run all of them. how ever this files count might vary when new requests are added and some are removed. So I want to set the loop count to the number of files in the folder. So that the user will not have to know the exact count. IS anyone has come across similar scenario and got a solution ?
Thank you in advance.
You can work it around with some scripting as:
Add a Beanshell Sampler to your test plan
Put the following code into the Beanshell Sampler's "Script" area:
File folder = new File("/path/to/your/folder");
File [] files = folder.listFiles();
int loops = files.length; =
vars.put("loops", String.valueOf(loops));
Add Loop Controller after the Beanshell Sampler
Put ${loops} into "Loop Count" input field
See How to use BeanShell: JMeter's favorite built-in component guide for comprehensive information on scripting in JMeter.
I am developing a web application and I need some parameters from properties files. These parameters have the following structure:
parameter1.field = Field 1
parameter1.value = Value 1
parameter2.field = Field 2
parameter2.value = Value 2
...
I personally don't like this data structure, and I'd like to organize them in a more simple way, like this:
parameter1 = Field1,Value 1
parameter2 = Field2,Value 2
...
My question is if there is any other way to organize information in a properties file for data like these, for example, in an array structure or something similar.
Thank you very much in advance
You can use a JSON file instead, which allows you for a more complicated structure.
There is no standard way to represent non-flat structures in a properties file, and everything that you do would be a custom solution.