I need to use data from RDBC request in HTTP request. Before ask this question I read these topics:
- How to use responses from a Jmeter JDBC Request in a HTTP Request
- JMeter use beanshell variable in HTTP Request
- JMeter get jdbc request data and send each with http post request in a spring service how-to
but I still don't know how to do this.
Test Structure:
JDBC Connection Configuration
JDBC Request
ForEach Controller
BeanShell Sampler
HTTP Request
My steps:
- Created JDBC Request that return data in 2 columns and added variable names (years, elements).
- Next I use ForEach Controller to read data from rows. Input variable prefix: years, elements and Output variable name: years1, elements1;
parse data from variables with BeanShell Sampler:
String yearsRange = vars.get("years1"); String year = yearsRange.split("-")[1]; String ElementsStr = vars.get("elements1"); String element = ElementsStr.split(" ")[1]; vars.put("year", year); vars.put("element", element);
And now I create HTTP Request with parameters:
year ${year}; element ${element};
I know that problem is with ForEach Controller (if I set one variable, all works fine) but I don't have any idea how to make it work with 2 or more variables.
Please give me advice what i'm doing wrong?