0
votes

I got stuck to a really annoying issue. Looks pretty simple to solve but I can't see what am I doing wrong.

All started from JMeter: more than nine parameters from Jenkins.

I managed to get the values from Jenkins in Jmeter by spiting an array.

String line = "${__P(jenkinsparams)}";
String[] words = line.split(",");

String looks like:

-Jjenkinsparams="999,999,8443,1433,SQL2012,sa"

So I have:

  • words[0] = 999;
  • words[1] = 999;
  • words[2] = 8443;
  • [...]
  • words[5] = sa;

This operation is made inside a BeanShell Sampler with 1 thread. How can I use these values as further on? Even in different Thread Groups.

I've tried:

props.put("SqlIP",words[0]);
props.put("SqlInstance", words[1]);

but ${__P(SqlIP)} doesn't retrieve the value when used in JDBC Connection Configuration as:

jdbc:sqlserver://${__P(SqlIP)}\\${__P(SqlInstance)}

How can I use properties/variables to send data from that array to build an JDBC connection? I need them for: SQL IP, SQL instance, SQL username and SQL password. All sent in that array from Jenkins. Thank you

1

1 Answers

1
votes

Because JDBC Connection Configuration is a Configuration element and according to Execution Order it's kicked off before any Beanshell test elements. You will have to come up with another way of setting the value.

I'm not aware of any parameters number limit on JMeter level, if you're running an exotic shell or a form of custom JMeter startup script which introduces this limitation you can work it around by putting your configuration into user.properties file or a custom properties file which can be passed via -q parameter, check out Apache JMeter Properties Customization Guide to learn more about setting and overriding JMeter Properties