JMeter pre-processed variable as part of report file name - sql

In my test plan I have JDBC PreProcessor that captures a single value that I'm trying to save into a variable. Then I want to reuse this variable as part of summary report's file name.
I wonder if creating that creating that variable happens too late because I always get literal value logs/${session_id_1}-summary.cvs rather than logs/1234-summary.cvs
I'm also not sure if I need to use resultVariable or variableNames to store the value. So far I tried different combinations with no luck
Then I'm also not clear at which point I should attach the pre-processor, to the first sampler?
Here's my latest (short) version of JMX:
<?xml version="1.0" encoding="UTF-8"?>
<jmeterTestPlan version="1.2" properties="2.9" jmeter="3.0 r1743807">
<hashTree>
<TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="TPCDS Benchmark Test Plan TPG Flavor" enabled="true">
<stringProp name="TestPlan.comments"></stringProp>
<boolProp name="TestPlan.functional_mode">true</boolProp>
<boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
<elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
<collectionProp name="Arguments.arguments"/>
</elementProp>
<stringProp name="TestPlan.user_define_classpath"></stringProp>
</TestPlan>
<hashTree>
<ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="JDBC Users" enabled="true">
<stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
<elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
<boolProp name="LoopController.continue_forever">false</boolProp>
<stringProp name="LoopController.loops">1</stringProp>
</elementProp>
<stringProp name="ThreadGroup.num_threads">1</stringProp>
<stringProp name="ThreadGroup.ramp_time">1</stringProp>
<longProp name="ThreadGroup.start_time">1370729701000</longProp>
<longProp name="ThreadGroup.end_time">1370729701000</longProp>
<boolProp name="ThreadGroup.scheduler">false</boolProp>
<stringProp name="ThreadGroup.duration"></stringProp>
<stringProp name="ThreadGroup.delay"></stringProp>
</ThreadGroup>
<hashTree>
<JDBCDataSource guiclass="TestBeanGUI" testclass="JDBCDataSource" testname="JDBC_Configuration_tpcds" enabled="true">
<boolProp name="autocommit">true</boolProp>
<stringProp name="checkQuery">Select 1</stringProp>
<stringProp name="connectionAge">5000</stringProp>
<stringProp name="dataSource">jdbcConfig_tpcds</stringProp>
<stringProp name="dbUrl">jdbc:teradata://${TDPID}/database=tpcds</stringProp>
<stringProp name="driver">com.teradata.jdbc.TeraDriver</stringProp>
<boolProp name="keepAlive">true</boolProp>
<stringProp name="password">tpcds</stringProp>
<stringProp name="poolMax">10</stringProp>
<stringProp name="timeout">10000</stringProp>
<stringProp name="transactionIsolation">DEFAULT</stringProp>
<stringProp name="trimInterval">60000</stringProp>
<stringProp name="username">tpcds</stringProp>
</JDBCDataSource>
<hashTree/>
<Arguments guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
<collectionProp name="Arguments.arguments">
<elementProp name="TDPID" elementType="Argument">
<stringProp name="Argument.name">TDPID</stringProp>
<stringProp name="Argument.value">${__P(target_dbs)}</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="DBC_USERNAME" elementType="Argument">
<stringProp name="Argument.name">DBC_USERNAME</stringProp>
<stringProp name="Argument.value">${__P(dbc_username,dbc)}</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="DBC_PASSWORD" elementType="Argument">
<stringProp name="Argument.name">DBC_PASSWORD</stringProp>
<stringProp name="Argument.value">${__P(dbc_password,dbc)}</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
</collectionProp>
</Arguments>
<hashTree/>
<JDBCSampler guiclass="TestBeanGUI" testclass="JDBCSampler" testname="query1" enabled="true">
<stringProp name="dataSource">jdbcConfig_tpcds</stringProp>
<stringProp name="query">${__FileToString(sql/query1.sql)}</stringProp>
<stringProp name="queryArguments"></stringProp>
<stringProp name="queryArgumentsTypes"></stringProp>
<stringProp name="queryType">Select Statement</stringProp>
<stringProp name="resultVariable"></stringProp>
<stringProp name="variableNames"></stringProp>
<stringProp name="queryTimeout"></stringProp>
<stringProp name="resultSetHandler">Store as String</stringProp>
</JDBCSampler>
<hashTree>
<JDBCPreProcessor guiclass="TestBeanGUI" testclass="JDBCPreProcessor" testname="Session PreProcessor" enabled="true">
<stringProp name="dataSource">jdbcConfig_tpcds</stringProp>
<stringProp name="query">SELECT SESSION as session_id;</stringProp>
<stringProp name="queryArguments"></stringProp>
<stringProp name="queryArgumentsTypes"></stringProp>
<stringProp name="queryTimeout"></stringProp>
<stringProp name="queryType">Select Statement</stringProp>
<stringProp name="resultSetHandler">Store as String</stringProp>
<stringProp name="resultVariable">session_id</stringProp>
<stringProp name="variableNames">session_id</stringProp>
</JDBCPreProcessor>
<hashTree/>
</hashTree>
<ResultCollector guiclass="SummaryReport" testclass="ResultCollector" testname="Summary Report" enabled="true">
<boolProp name="ResultCollector.error_logging">false</boolProp>
<objProp>
<name>saveConfig</name>
<value class="SampleSaveConfiguration">
<time>true</time>
<latency>true</latency>
<timestamp>true</timestamp>
<success>true</success>
<label>true</label>
<code>true</code>
<message>true</message>
<threadName>true</threadName>
<dataType>true</dataType>
<encoding>false</encoding>
<assertions>false</assertions>
<subresults>false</subresults>
<responseData>true</responseData>
<samplerData>false</samplerData>
<xml>true</xml>
<fieldNames>true</fieldNames>
<responseHeaders>false</responseHeaders>
<requestHeaders>false</requestHeaders>
<responseDataOnError>false</responseDataOnError>
<saveAssertionResultsFailureMessage>false</saveAssertionResultsFailureMessage>
<assertionsResultsToSave>0</assertionsResultsToSave>
<bytes>true</bytes>
<threadCounts>true</threadCounts>
<idleTime>true</idleTime>
<connectTime>true</connectTime>
</value>
</objProp>
<stringProp name="filename">logs/${session_id_1}-summary.xml</stringProp>
</ResultCollector>
<hashTree/>
</hashTree>
</hashTree>
</hashTree>
</jmeterTestPlan>

Changing filenames of Listeners test elements on the fly is not really supported in JMeter as Listeners are being initialized before any variables. The recommended way is:
Get your Terradata session id outside of JMeter, i.e. using BTEQ or equivalent
Pass the value to JMeter via -J command line argument like:
jmeter -Jsession_id_1=1234 -n -t /path/to/testplan.jmx
Refer the session id value via __P() function where required as
${__P(session_id_1,)}
If for any reason you still need to do it inside JMeter test script, here is a possible solution, however keep in mind the following:
You need to remove everything from "Filename" input of the Summary Report listener. Just let it be blank.
Make sure that below code is executed only once and with only one thread.
So:
Add JSR223 PostProcessor as a child of the query1 sampler and after the Session PreProcessor
Select groovy in the "Language" drop-down
Put the following code into JSR223 PostProcessor "Script" area:
import org.apache.jmeter.engine.StandardJMeterEngine;
import org.apache.jmeter.reporters.ResultCollector;
import org.apache.jorphan.collections.HashTree;
import org.apache.jorphan.collections.SearchByClass;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
StandardJMeterEngine engine = ctx.getEngine();
Field test = engine.getClass().getDeclaredField("test");
test.setAccessible(true);
HashTree testPlanTree = (HashTree) test.get(engine);
SearchByClass summaryReportsSearch = new SearchByClass(ResultCollector.class);
testPlanTree.traverse(summaryReportsSearch);
Collection summaryReports = summaryReportsSearch.getSearchResults();
ResultCollector summaryReport = summaryReports.iterator().next();
Class [] fileNameParam = new Class[1];
fileNameParam[0] = String.class;
Method setFileName = summaryReport.getClass().getDeclaredMethod("setFilenameProperty", fileNameParam);
setFileName.setAccessible(true);
setFileName.invoke(summaryReport, new String(vars.get("session_id_1")));
Method init = summaryReport.getClass().getDeclaredMethod("initializeFileOutput");
init.setAccessible(true);
init.invoke(summaryReport);
If you're using JMeter 3.0 - groovy is bundled. For previous JMeter versions you will need to install groovy language support manually, check out Beanshell vs JSR223 vs Java JMeter Scripting: The Performance-Off You've Been Waiting For! article for groovy engine installation instructions and scripting best practices.

you cannot use a variable as part of a summary report file name as a variable exist per User thread and after summary report has been initialized.
Use property instead:
https://jmeter.apache.org/usermanual/functions.html

Related

Why am I getting Endpoint "logout/" not handled by mod_auth_mellon when attempting to logout of my application

I am running apache 2.4.7 on an oraclelinux 8.5 compute instance.
I have the mod_auth_mellon 0.14 module installed and configured per all the documentation.
I have succeeded in performing an sp-initiated sso login to my application, but when I attempt to logout of the sso session using the following url:
https://example.com/mellon/logout/?ReturnTo=/logout.html
I get a 404 page not found error.
After enabling mellon diagnostics I see the following error message at the end of the request diagnostics for this GET request:
[APLOG_ERR auth_mellon_handler.c:3551] Endpoint "logout/" not handled by mod_auth_mellon
My sp_metadata.xml file is as follows:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<EntityDescriptor
entityID="https://example.com/mellon/metadata"
xmlns="urn:oasis:names:tc:SAML:2.0:metadata">
<SPSSODescriptor
AuthnRequestsSigned="true"
WantAssertionsSigned="true"
protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol">
<KeyDescriptor use="signing">
<ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:X509Data>
<ds:X509Certificate>MIICvDCCAaQCCQDRIF/j7C1rITANBgkqhkiG9w0BAQsFADAgMR4wHAYDVQQDDBVh
Y3JkZXYub3JhY2xlY29ycC5jb20wHhcNMjIwNjIyMjIyNjA5WhcNMzIwNjIxMjIy
NjA5WjAgMR4wHAYDVQQDDBVhY3JkZXYub3JhY2xlY29ycC5jb20wggEiMA0GCSqG
SIb3DQEBAQUAA4IBDwAwggEKAoIBAQDKGLl90UeL+CSb8+7KtlxSUBy87RIlQ2l8
jtzftHsOOOX+L2gZFPPxmj5fP8R2pWJq4rjt06BES8lV2bP7Cn9H+Xu8cqKxsnYl
ArMqZu0StHYSdATx0WDF8Ay3NFdmytOYOK8tYjWt5ZP/zb5FGqKbjh4JdxwZL62C
FsnGYVOubpsu+A7WBZ2lKhZws1kdWmKY+tsFg9veSb4P0L6eprQ1GmVoB4RFSzfM
A1QgnTqbK0cqzNKOFEtQXbSjFkCAtQIHb1wvcByCTjbhT5/RW8y2Vqs+d9pmcN45
9FZ5rX8Jz5iCuA/R1OJeVgeDBC+XKEtQTNLteg/eMsumWde7XVFNAgMBAAEwDQYJ
KoZIhvcNAQELBQADggEBAATelS0+K50iIzj3LB0U/3zU+ASfVEZmGKE9C0LqrQph
8nqmb6MkbnrwcYfY6qsgDlmukWzv5p6K9FgD/CzN78wnoGazFpjFo2t1HszUJPj8
PEcoS8ry92MWkA4WV+R2lZ2y0fDrlqHBY9I27d30I+WokiLoVcfaMfOnC6sdovV8
+zkvyEzqFwSxZ66EDKR0Zg2ksVrrl+QSeAAacUNRKl8ePYHmraBwYIdFzTdZtz/u
TGKeRlNCO7Fqpx343h007ynzkTq0ZePiJVT2jAMkWqx66JeUno08omCrcAq4mZxw
cqN27U4MmNcNITE0C2l9rJDP7lAXcla/DN2V/mH5iD4=</ds:X509Certificate>
</ds:X509Data>
</ds:KeyInfo>
</KeyDescriptor>
<KeyDescriptor use="encryption">
<ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:X509Data>
<ds:X509Certificate>MIICvDCCAaQCCQDRIF/j7C1rITANBgkqhkiG9w0BAQsFADAgMR4wHAYDVQQDDBVh
Y3JkZXYub3JhY2xlY29ycC5jb20wHhcNMjIwNjIyMjIyNjA5WhcNMzIwNjIxMjIy
NjA5WjAgMR4wHAYDVQQDDBVhY3JkZXYub3JhY2xlY29ycC5jb20wggEiMA0GCSqG
SIb3DQEBAQUAA4IBDwAwggEKAoIBAQDKGLl90UeL+CSb8+7KtlxSUBy87RIlQ2l8
jtzftHsOOOX+L2gZFPPxmj5fP8R2pWJq4rjt06BES8lV2bP7Cn9H+Xu8cqKxsnYl
ArMqZu0StHYSdATx0WDF8Ay3NFdmytOYOK8tYjWt5ZP/zb5FGqKbjh4JdxwZL62C
FsnGYVOubpsu+A7WBZ2lKhZws1kdWmKY+tsFg9veSb4P0L6eprQ1GmVoB4RFSzfM
A1QgnTqbK0cqzNKOFEtQXbSjFkCAtQIHb1wvcByCTjbhT5/RW8y2Vqs+d9pmcN45
9FZ5rX8Jz5iCuA/R1OJeVgeDBC+XKEtQTNLteg/eMsumWde7XVFNAgMBAAEwDQYJ
KoZIhvcNAQELBQADggEBAATelS0+K50iIzj3LB0U/3zU+ASfVEZmGKE9C0LqrQph
8nqmb6MkbnrwcYfY6qsgDlmukWzv5p6K9FgD/CzN78wnoGazFpjFo2t1HszUJPj8
PEcoS8ry92MWkA4WV+R2lZ2y0fDrlqHBY9I27d30I+WokiLoVcfaMfOnC6sdovV8
+zkvyEzqFwSxZ66EDKR0Zg2ksVrrl+QSeAAacUNRKl8ePYHmraBwYIdFzTdZtz/u
TGKeRlNCO7Fqpx343h007ynzkTq0ZePiJVT2jAMkWqx66JeUno08omCrcAq4mZxw
cqN27U4MmNcNITE0C2l9rJDP7lAXcla/DN2V/mH5iD4=</ds:X509Certificate>
</ds:X509Data>
</ds:KeyInfo>
</KeyDescriptor>
<SingleLogoutService
Binding="urn:oasis:names:tc:SAML:2.0:bindings:SOAP"
Location="https://example.com/mellon/logout" />
<SingleLogoutService
Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"
Location="https://example.com/mellon/logout" />
<NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:transient</NameIDFormat>
<AssertionConsumerService
index="0"
isDefault="true"
Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
Location="https://example.com/mellon/postResponse" />
<AssertionConsumerService
index="1"
Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact"
Location="https://example.com/mellon/artifactResponse" />
<AssertionConsumerService
index="2"
Binding="urn:oasis:names:tc:SAML:2.0:bindings:PAOS"
Location="https://example.com/mellon/paosResponse" />
</SPSSODescriptor>
</EntityDescriptor>
According to the documentation here:
https://github.com/latchset/mod_auth_mellon#logging-out
Your syntax is incorrect.
It should be:
https://example.com/mellon/logout?ReturnTo=/logout.html
(notice the removed slash after logout)

Jmeter + Taurus. How to set up thread group properties via property function

I am currently working on testing small API for our company, where we need to randomly spread number of calls to all methods of API. I am using Jmeter 5.3 and taurus.
Number of threads is generated via JSR223 sampler groovy script based on number specified in passed property file. Rampup period and loop count are specified by calling functions ${__P(rampup.period,)} ${__P(loop.count,)}
The problem is that when I am running jmeter standalone from command line all functions work correctly. But if I try to use taurus with that scenario all thread groups that acquire rampup period, loop count and thread count from properties are not working. It seems like jmeter cannot acquire properties via functions when run in taurus. Below are my scenario and property files. I have to omit some of the data from file which may be confidential
My taurus yml is:
execution:
- executor: jmeter
scenario: test
scenarios:
test:
script: *path to jmx file here*
included-configs:
- *path to yml property file here*
modules:
jmeter:
path: *path to existing jmeter executor here*
reporting:
- module: console
- module: final-stats
summary: true # overall samples count and percent of failures
percentiles: true # display average times and percentiles
failed-labels: false # provides list of sample labels with failures
test-duration: true # provides test duration
Part of my yml file with properties:
number.of.users: 10000
rampup.period: 300
loop.count: 1
client.id: *client id*
array.of.clients: [*array of ids*]
eks.ids: [1,2,3]
I am fairly new to taurus, jmeter and load testing in general. Am I doing something wrong (maybe I have to acquire properties or pass them some other way) or is it a bug of sorts? The only workaround I can think of now is put all properties via JSR sampler by using props.put and then executing something like ${__groovy(props.get('loop.count'),)} (for some reason in this version of jmeter you can access props that were put via script only in this manner)
Try the following:
properties.yaml
modules:
jmeter:
properties:
my-number.of.users: 10
test.yaml
execution:
- executor: jmeter
scenario: test
scenarios:
test:
script: test.jmx
included-configs:
- properties.yaml
modules:
jmeter:
path: jmeter
test.jmx
<?xml version="1.0" encoding="UTF-8"?>
<jmeterTestPlan version="1.2" properties="5.0" jmeter="5.4.3">
<hashTree>
<TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan" enabled="true">
<stringProp name="TestPlan.comments"></stringProp>
<boolProp name="TestPlan.functional_mode">false</boolProp>
<boolProp name="TestPlan.tearDown_on_shutdown">true</boolProp>
<boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
<elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
<collectionProp name="Arguments.arguments"/>
</elementProp>
<stringProp name="TestPlan.user_define_classpath"></stringProp>
</TestPlan>
<hashTree>
<ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Thread Group" enabled="true">
<stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
<elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
<boolProp name="LoopController.continue_forever">false</boolProp>
<stringProp name="LoopController.loops">1</stringProp>
</elementProp>
<stringProp name="ThreadGroup.num_threads">${__P(my-number.of.users,)}</stringProp>
<stringProp name="ThreadGroup.ramp_time">1</stringProp>
<boolProp name="ThreadGroup.scheduler">false</boolProp>
<stringProp name="ThreadGroup.duration"></stringProp>
<stringProp name="ThreadGroup.delay"></stringProp>
<boolProp name="ThreadGroup.same_user_on_next_iteration">true</boolProp>
</ThreadGroup>
<hashTree>
<DebugSampler guiclass="TestBeanGUI" testclass="DebugSampler" testname="Debug Sampler" enabled="true">
<boolProp name="displayJMeterProperties">false</boolProp>
<boolProp name="displayJMeterVariables">true</boolProp>
<boolProp name="displaySystemProperties">false</boolProp>
</DebugSampler>
<hashTree/>
</hashTree>
</hashTree>
</hashTree>
</jmeterTestPlan>
Image version:
Textual representation of the number of threads:
${__P(my-number.of.users,)}
Whenever you change 10 in the my-number.of.users: 10 line in properties.yaml the change will be reflected in the number of executed threads
More information:
Taurus: Included Configs
Taurus JMeter Executor: JMeter Properties and Variables
Apache JMeter Properties Customization Guide

JMeterLib Robot Framework- Pass parameters as keywords

I have a csv file with 3 columns, I am reading the columns and creating a different list for each column I want to pass this with JmeterLib for robot framework, I want to read the list and send each value in the list a parameter for "Load testing"-ish
My goal is to have 200+ request per second, and i need to pass the list values for each thread at a time.
Is this possible to do with JmeterLib and Robot Framework?
*** Settings ***
Library JMeterLib
Library csvLibrary.py
*** Variables ***
${JMeter2_path} C:/Users/User/Desktop/tools/apache-jmeter*/bin/jmeter.bat
${JMeter_script_1thread1loop_path} Test Plan.jmx
${JMeter_log01_path} results/jmeterTest1Thread1Loop_log01.jtl
*** Test Cases ***
Sort CSV Staff location file
${staff_ID_list}= create list
${DeviceName_list}= create list
${ExternalID_list}= create list
${row_ID}= convert to integer 1
:FOR ${Row_Elements} IN RANGE ${row_ID} 517
\ ${read_csv} = read cell value by row staff.csv ${row_ID}
\ log ${read_csv}
\ ${Staff_ID} get from dictionary ${read_csv} Col1
\ append to list ${staff_ID_list} '${Staff_ID}'
\ ${External_ID} get from dictionary ${read_csv} Col2
\ append to list ${ExternalID_list} '${External_ID}'
\ ${DeviceName} get from dictionary ${read_csv} Col3
\ append to list ${DeviceName_list} '${DeviceName}'
\ ${row_ID}= evaluate ${row_ID} + 1
log ${staff_ID_list}
log ${ExternalID_list}
log ${DeviceName_list}
jmeter2_tc1_justRunJMeter
run jmeter ${JMeter2_path} ${JMeter_script_1thread1loop_path} ${JMeter_log01_path}
And this is my test plan to hit stackoverflow 200 times per second.
<?xml version="1.0" encoding="UTF-8"?>
<jmeterTestPlan version="1.2" properties="5.0" jmeter="5.0 r1840935">
<hashTree>
<TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan" enabled="true">
<stringProp name="TestPlan.comments"></stringProp>
<boolProp name="TestPlan.functional_mode">false</boolProp>
<boolProp name="TestPlan.tearDown_on_shutdown">true</boolProp>
<boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
<elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
<collectionProp name="Arguments.arguments"/>
</elementProp>
<stringProp name="TestPlan.user_define_classpath"></stringProp>
</TestPlan>
<hashTree>
<ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Thread Group" enabled="true">
<stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
<elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
<boolProp name="LoopController.continue_forever">false</boolProp>
<stringProp name="LoopController.loops">2</stringProp>
</elementProp>
<stringProp name="ThreadGroup.num_threads">200</stringProp>
<stringProp name="ThreadGroup.ramp_time">0.1</stringProp>
<boolProp name="ThreadGroup.scheduler">false</boolProp>
<stringProp name="ThreadGroup.duration"></stringProp>
<stringProp name="ThreadGroup.delay"></stringProp>
</ThreadGroup>
<hashTree/>
<ConfigTestElement guiclass="HttpDefaultsGui" testclass="ConfigTestElement" testname="HTTP Request Defaults" enabled="true">
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
<collectionProp name="Arguments.arguments"/>
</elementProp>
<stringProp name="HTTPSampler.domain">stackoverflow.com</stringProp>
<stringProp name="HTTPSampler.port"></stringProp>
<stringProp name="HTTPSampler.protocol"></stringProp>
<stringProp name="HTTPSampler.contentEncoding"></stringProp>
<stringProp name="HTTPSampler.path">/</stringProp>
<stringProp name="HTTPSampler.concurrentPool">6</stringProp>
<stringProp name="HTTPSampler.connect_timeout"></stringProp>
<stringProp name="HTTPSampler.response_timeout"></stringProp>
</ConfigTestElement>
<hashTree/>
<ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="View Results Tree" enabled="true">
<boolProp name="ResultCollector.error_logging">false</boolProp>
<objProp>
<name>saveConfig</name>
<value class="SampleSaveConfiguration">
<time>true</time>
<latency>true</latency>
<timestamp>true</timestamp>
<success>true</success>
<label>true</label>
<code>true</code>
<message>true</message>
<threadName>true</threadName>
<dataType>true</dataType>
<encoding>false</encoding>
<assertions>true</assertions>
<subresults>true</subresults>
<responseData>false</responseData>
<samplerData>false</samplerData>
<xml>false</xml>
<fieldNames>true</fieldNames>
<responseHeaders>false</responseHeaders>
<requestHeaders>false</requestHeaders>
<responseDataOnError>false</responseDataOnError>
<saveAssertionResultsFailureMessage>true</saveAssertionResultsFailureMessage>
<assertionsResultsToSave>0</assertionsResultsToSave>
<bytes>true</bytes>
<sentBytes>true</sentBytes>
<url>true</url>
<threadCounts>true</threadCounts>
<idleTime>true</idleTime>
<connectTime>true</connectTime>
</value>
</objProp>
<stringProp name="filename"></stringProp>
</ResultCollector>
<hashTree/>
<ResultCollector guiclass="SummaryReport" testclass="ResultCollector" testname="Summary Report" enabled="true">
<boolProp name="ResultCollector.error_logging">false</boolProp>
<objProp>
<name>saveConfig</name>
<value class="SampleSaveConfiguration">
<time>true</time>
<latency>true</latency>
<timestamp>true</timestamp>
<success>true</success>
<label>true</label>
<code>true</code>
<message>true</message>
<threadName>true</threadName>
<dataType>true</dataType>
<encoding>false</encoding>
<assertions>true</assertions>
<subresults>true</subresults>
<responseData>false</responseData>
<samplerData>false</samplerData>
<xml>false</xml>
<fieldNames>true</fieldNames>
<responseHeaders>false</responseHeaders>
<requestHeaders>false</requestHeaders>
<responseDataOnError>false</responseDataOnError>
<saveAssertionResultsFailureMessage>true</saveAssertionResultsFailureMessage>
<assertionsResultsToSave>0</assertionsResultsToSave>
<bytes>true</bytes>
<sentBytes>true</sentBytes>
<url>true</url>
<threadCounts>true</threadCounts>
<idleTime>true</idleTime>
<connectTime>true</connectTime>
</value>
</objProp>
<stringProp name="filename"></stringProp>
</ResultCollector>
<hashTree/>
</hashTree>
</hashTree>
My Question: is there a way to pass the in the parameters dynamically to the test plan upon execution with robot framework?

JMeter IBM MQ JMS Point-to-Point test getting NumberFormatException

I need to run a throughput benchmark test on IBM MQ 8.0.0.4. I installed JMeter 3.0 and followed the instructions given here and here and here (don't ave enough points to post the third link). I resolved all of the ClassNotFound errors by adding jars to the lib/ext directory (springcore, springframework (jms and beans), javax (jms and resource), ibm mq, ibm mqjms, jmeter jms skip, dhbcore).
I am getting a NumberFormatException on the transportType attribute (set to "CLIENT"). I have exhausted all searches for a resolution -- any help would be greatly appreciated.
Here is the configuration of the Sampler:
<?xml version="1.0" encoding="UTF-8"?>
<jmeterTestPlan version="1.2" properties="3.1" jmeter="3.1 r1770033">
<hashTree>
<TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="MQ Benchmark" enabled="true">
<stringProp name="TestPlan.comments"></stringProp>
<boolProp name="TestPlan.functional_mode">false</boolProp>
<boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
<elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
<collectionProp name="Arguments.arguments"/>
</elementProp>
<stringProp name="TestPlan.user_define_classpath"></stringProp>
</TestPlan>
<hashTree>
<ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Thread Group" enabled="true">
<stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
<elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
<boolProp name="LoopController.continue_forever">false</boolProp>
<stringProp name="LoopController.loops">10</stringProp>
</elementProp>
<stringProp name="ThreadGroup.num_threads">1</stringProp>
<stringProp name="ThreadGroup.ramp_time">1</stringProp>
<longProp name="ThreadGroup.start_time">1480739219000</longProp>
<longProp name="ThreadGroup.end_time">1480739219000</longProp>
<boolProp name="ThreadGroup.scheduler">false</boolProp>
<stringProp name="ThreadGroup.duration"></stringProp>
<stringProp name="ThreadGroup.delay"></stringProp>
</ThreadGroup>
<hashTree>
<JMSSampler guiclass="JMSSamplerGui" testclass="JMSSampler" testname="JMS Point-to-Point" enabled="true">
<stringProp name="JMSSampler.queueconnectionfactory">CONNECTION_FACTORY</stringProp>
<stringProp name="JMSSampler.SendQueue">Q.RQST</stringProp>
<stringProp name="JMSSampler.ReceiveQueue">Q.RECV</stringProp>
<boolProp name="JMSSampler.isFireAndForget">false</boolProp>
<boolProp name="JMSSampler.isNonPersistent">false</boolProp>
<boolProp name="JMSSampler.useReqMsgIdAsCorrelId">true</boolProp>
<stringProp name="JMSSampler.timeout">100000</stringProp>
<stringProp name="HTTPSamper.xml_data">This is a test message</stringProp>
<stringProp name="JMSSampler.initialContextFactory">com.elega9t.jmeter.jms.InitialContextFactory</stringProp>
<stringProp name="JMSSampler.contextProviderUrl"></stringProp>
<elementProp name="JMSSampler.jndiProperties" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
<collectionProp name="Arguments.arguments">
<elementProp name="channel" elementType="Argument">
<stringProp name="Argument.name">channel</stringProp>
<stringProp name="Argument.value">TEST.SVRCONN</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="hostName" elementType="Argument">
<stringProp name="Argument.name">hostName</stringProp>
<stringProp name="Argument.value">redacted</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="port" elementType="Argument">
<stringProp name="Argument.name">port</stringProp>
<stringProp name="Argument.value">1414</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="queueManager" elementType="Argument">
<stringProp name="Argument.name">queueManager</stringProp>
<stringProp name="Argument.value">redacted</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="transportType" elementType="Argument">
<stringProp name="Argument.name">transportType</stringProp>
<stringProp name="Argument.value">CLIENT</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="java.naming.security.principal" elementType="Argument">
<stringProp name="Argument.name">java.naming.security.principal</stringProp>
<stringProp name="Argument.value">redacted</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="java.naming.security.credentials" elementType="Argument">
<stringProp name="Argument.name">java.naming.security.credentials</stringProp>
<stringProp name="Argument.value">redacted</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="queue.Q.RQST" elementType="Argument">
<stringProp name="Argument.name">queue.Q.RQST</stringProp>
<stringProp name="Argument.value">TEST.MQ.REQUEST</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="queue.Q.RECV" elementType="Argument">
<stringProp name="Argument.name">queue.Q.RECV</stringProp>
<stringProp name="Argument.value">TEST.MQ.RECEIVE</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
</collectionProp>
</elementProp>
</JMSSampler>
<hashTree/>
</hashTree>
</hashTree>
</hashTree>
</jmeterTestPlan>
Here's the output:
[root#jspqbusisa12 bin]# ./jmeter -n -t JMS_Point_to_Point_TEST.jmx
Writing log file to: /usr/local/apache-jmeter-3.0/bin/jmeter.log
Creating summariser <summary>
Created the tree successfully using JMS_Point_to_Point_TEST.jmx
Starting the test # Wed Dec 07 10:35:50 EST 2016 (1481124950312)
Waiting for possible Shutdown/StopTestNow/Heapdump message on port 4445
summary = 10 in 00:00:00 = 51.8/s Avg: 0 Min: 0 Max: 1 Err: 10 (100.00%)
Tidying up ... # Wed Dec 07 10:35:50 EST 2016 (1481124950643)
... end of run
Here's the jmeter.log:
2016/12/07 10:35:49 INFO - jmeter.util.JMeterUtils: Setting Locale to en_US
2016/12/07 10:35:49 INFO - jmeter.JMeter: Loading user properties from: /usr/local/apache-jmeter-3.0/bin/user.properties
2016/12/07 10:35:49 INFO - jmeter.JMeter: Loading system properties from: /usr/local/apache-jmeter-3.0/bin/system.properties
2016/12/07 10:35:49 INFO - jmeter.JMeter: Copyright (c) 1998-2016 The Apache Software Foundation
2016/12/07 10:35:49 INFO - jmeter.JMeter: Version 3.0 r1743807
2016/12/07 10:35:49 INFO - jmeter.JMeter: java.version=1.7.0_80
2016/12/07 10:35:49 INFO - jmeter.JMeter: java.vm.name=Java HotSpot(TM) 64-Bit Server VM
2016/12/07 10:35:49 INFO - jmeter.JMeter: os.name=Linux
2016/12/07 10:35:49 INFO - jmeter.JMeter: os.arch=amd64
2016/12/07 10:35:49 INFO - jmeter.JMeter: os.version=2.6.32-279.el6.x86_64
2016/12/07 10:35:49 INFO - jmeter.JMeter: file.encoding=UTF-8
2016/12/07 10:35:49 INFO - jmeter.JMeter: Max memory =515375104
2016/12/07 10:35:49 INFO - jmeter.JMeter: Available Processors =8
2016/12/07 10:35:49 INFO - jmeter.JMeter: Default Locale=English (United States)
2016/12/07 10:35:50 INFO - jmeter.JMeter: JMeter Locale=English (United States)
2016/12/07 10:35:50 INFO - jmeter.JMeter: JMeterHome=/usr/local/apache-jmeter-3.0
2016/12/07 10:35:50 INFO - jmeter.JMeter: user.dir =/usr/local/apache-jmeter-3.0/bin
2016/12/07 10:35:50 INFO - jmeter.JMeter: PWD =/usr/local/apache-jmeter-3.0/bin
2016/12/07 10:35:50 INFO - jmeter.JMeter: IP: 10.98.169.85 Name: jspqbusisa12 FullName: jspqbusisa12
2016/12/07 10:35:50 INFO - jmeter.JMeter: user.classpath=/usr/local/apache-jmeter-3.0/lib/ext
2016/12/07 10:35:50 INFO - jmeter.JMeter: Adding to classpath and loader: /usr/local/apache-jmeter-3.0/lib/ext
2016/12/07 10:35:50 INFO - jmeter.services.FileServer: Default base='/usr/local/apache-jmeter-3.0/bin'
2016/12/07 10:35:50 INFO - jmeter.services.FileServer: Set new base='/usr/local/apache-jmeter-3.0/bin'
2016/12/07 10:35:50 INFO - jmeter.save.SaveService: Testplan (JMX) version: 2.2. Testlog (JTL) version: 2.2
2016/12/07 10:35:50 INFO - jmeter.save.SaveService: Using SaveService properties file encoding UTF-8
2016/12/07 10:35:50 INFO - jmeter.save.SaveService: Using SaveService properties version 2.9
2016/12/07 10:35:50 INFO - jmeter.save.SaveService: All converter versions present and correct
2016/12/07 10:35:50 INFO - jmeter.save.SaveService: Loading file: JMS_Point_to_Point_TEST.jmx
2016/12/07 10:35:50 INFO - jmeter.JMeter: Creating summariser <summary>
2016/12/07 10:35:50 INFO - jmeter.engine.StandardJMeterEngine: Running the test!
2016/12/07 10:35:50 INFO - jmeter.samplers.SampleEvent: List of sample_variables: []
2016/12/07 10:35:50 INFO - jmeter.samplers.SampleEvent: List of sample_variables: []
2016/12/07 10:35:50 INFO - jmeter.engine.util.CompoundVariable: Note: Function class names must contain the string: '.functions.'
2016/12/07 10:35:50 INFO - jmeter.engine.util.CompoundVariable: Note: Function class names must not contain the string: '.gui.'
2016/12/07 10:35:50 INFO - jmeter.JMeter: Running test (1481124950446)
2016/12/07 10:35:50 INFO - jmeter.engine.StandardJMeterEngine: Starting ThreadGroup: 1 : Thread Group
2016/12/07 10:35:50 INFO - jmeter.engine.StandardJMeterEngine: Starting 1 threads for group Thread Group.
2016/12/07 10:35:50 INFO - jmeter.engine.StandardJMeterEngine: Thread will continue on error
2016/12/07 10:35:50 INFO - jmeter.threads.ThreadGroup: Starting thread group number 1 threads 1 ramp-up 1 perThread 1000.0 delayedStart=false
2016/12/07 10:35:50 INFO - jmeter.threads.ThreadGroup: Started thread group number 1
2016/12/07 10:35:50 INFO - jmeter.engine.StandardJMeterEngine: All thread groups have been started
2016/12/07 10:35:50 INFO - jmeter.threads.JMeterThread: Thread started: Thread Group 1-1
2016/12/07 10:35:50 ERROR - jmeter.protocol.jms.sampler.JMSSampler: For input string: "CLIENT" java.lang.NumberFormatException: For input string: "CLIENT"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:492)
at java.lang.Integer.parseInt(Integer.java:527)
at com.elega9t.jmeter.jms.InitialContextFactory$1.lookup(InitialContextFactory.java:56)
at javax.naming.InitialContext.lookup(InitialContext.java:411)
at org.apache.jmeter.protocol.jms.sampler.JMSSampler.threadStarted(JMSSampler.java:329)
at org.apache.jmeter.threads.JMeterThread$ThreadListenerTraverser.addNode(JMeterThread.java:647)
at org.apache.jorphan.collections.HashTree.traverseInto(HashTree.java:996)
at org.apache.jorphan.collections.HashTree.traverse(HashTree.java:978)
at org.apache.jmeter.threads.JMeterThread.threadStarted(JMeterThread.java:616)
at org.apache.jmeter.threads.JMeterThread.initRun(JMeterThread.java:604)
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:237)
at java.lang.Thread.run(Thread.java:745)
2016/12/07 10:35:50 INFO - jmeter.samplers.SampleResult: Note: Sample TimeStamps are START times
2016/12/07 10:35:50 INFO - jmeter.samplers.SampleResult: sampleresult.default.encoding is set to ISO-8859-1
2016/12/07 10:35:50 INFO - jmeter.samplers.SampleResult: sampleresult.useNanoTime=true
2016/12/07 10:35:50 INFO - jmeter.samplers.SampleResult: sampleresult.nanoThreadSleep=5000
2016/12/07 10:35:50 WARN - jmeter.protocol.jms.sampler.JMSSampler: Session may not be null while creating message java.lang.IllegalStateException: Session may not be null while creating message
at org.apache.jmeter.protocol.jms.sampler.JMSSampler.createMessage(JMSSampler.java:189)
at org.apache.jmeter.protocol.jms.sampler.JMSSampler.sample(JMSSampler.java:145)
at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:465)
at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:410)
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:241)
at java.lang.Thread.run(Thread.java:745)
...
(( and then 9 more of these for each request submitted ))
...
2016/12/07 10:35:50 INFO - jmeter.threads.JMeterThread: Thread is done: Thread Group 1-1
2016/12/07 10:35:50 INFO - jmeter.threads.JMeterThread: Thread finished: Thread Group 1-1
2016/12/07 10:35:50 INFO - jmeter.engine.StandardJMeterEngine: Notifying test listeners of end of test
2016/12/07 10:35:50 INFO - jmeter.reporters.Summariser: summary = 10 in 00:00:00 = 51.8/s Avg: 0 Min: 0 Max: 1 Err: 10 (100.00%)
Any help would be appreciated -- I can't find any report of this issue and assume I'm doing something fundamentally wrong.
The knowledge center for MQ v8.0 documents the numeric value of the constant WMQ_CM_CLIENT is 1.
I would suggest you try setting the transportType attribute to the number 1 instead of the word CLIENT.

How to increase variable which I get in response and assign new value in next request JMETER

For example:
In response jmeter give me TOT_CHG = 4056,6.
Now I want to increase this variable TOT_CHG = 4056,6 + 100
and assign new increased value as a variable in next request. How can I do that?
First you need to add a Regular Expression Extractor to extract the value of TOT_GEN_CHG to put it in var TOT_CHG.
Using JSR223 Post processor and Groovy as language:
import java.util.*;
import java.text.*;
DecimalFormatSymbols symbols = new DecimalFormatSymbols();
symbols.setDecimalSeparator(',' as char);
NumberFormat format = new DecimalFormat ("000.00");
format.setDecimalFormatSymbols(symbols);
Float parsed = (Float) format.parse(vars["TOT_GEN_CHG"]).floatValue();
parsed += 100;
vars.put("NEW_VAR", format.format(parsed));
You can then use ${NEW_VAR}
To configure Groovy in jmeter, download it and unzip it, then add embeddable/groovy-all.jar in jmeter/lib folder and restart jmeter.
See example:
<?xml version="1.0" encoding="UTF-8"?>
<jmeterTestPlan version="1.2" properties="2.6" jmeter="2.12-SNAPSHOT.20140413">
<hashTree>
<TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Plan testów" enabled="true">
<stringProp name="TestPlan.comments"></stringProp>
<boolProp name="TestPlan.functional_mode">false</boolProp>
<boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
<elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="Zmienne zdefiniowane przez użytkownika" enabled="true">
<collectionProp name="Arguments.arguments"/>
</elementProp>
<stringProp name="TestPlan.user_define_classpath"></stringProp>
</TestPlan>
<hashTree>
<ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Thread Group" enabled="true">
<stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
<elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
<boolProp name="LoopController.continue_forever">false</boolProp>
<stringProp name="LoopController.loops">1</stringProp>
</elementProp>
<stringProp name="ThreadGroup.num_threads">1</stringProp>
<stringProp name="ThreadGroup.ramp_time">1</stringProp>
<longProp name="ThreadGroup.start_time">1399401625000</longProp>
<longProp name="ThreadGroup.end_time">1399401625000</longProp>
<boolProp name="ThreadGroup.scheduler">false</boolProp>
<stringProp name="ThreadGroup.duration"></stringProp>
<stringProp name="ThreadGroup.delay"></stringProp>
</ThreadGroup>
<hashTree>
<Arguments guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
<collectionProp name="Arguments.arguments">
<elementProp name="TOT_GEN_CHG" elementType="Argument">
<stringProp name="Argument.name">TOT_GEN_CHG</stringProp>
<stringProp name="Argument.value">123,23</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
</collectionProp>
</Arguments>
<hashTree/>
<DebugSampler guiclass="TestBeanGUI" testclass="DebugSampler" testname="Debug Sampler" enabled="true">
<boolProp name="displayJMeterProperties">false</boolProp>
<boolProp name="displayJMeterVariables">true</boolProp>
<boolProp name="displaySystemProperties">false</boolProp>
</DebugSampler>
<hashTree>
<JSR223PostProcessor guiclass="TestBeanGUI" testclass="JSR223PostProcessor" testname="JSR223 PostProcessor" enabled="true">
<stringProp name="cacheKey"></stringProp>
<stringProp name="filename"></stringProp>
<stringProp name="parameters"></stringProp>
<stringProp name="script">import java.util.*;
import java.text.*;
DecimalFormatSymbols symbols = new DecimalFormatSymbols();
symbols.setDecimalSeparator(&apos;,&apos; as char);
NumberFormat format = new DecimalFormat ("000.00");
format.setDecimalFormatSymbols(symbols);
//NumberFormat format = NumberFormat.getIntegerInstance(Locale.FRENCH);
Float parsed = (Float) format.parse(vars["TOT_GEN_CHG"]).floatValue();
parsed += 100;
vars.put("NEW_VAR", format.format(parsed));</stringProp>
<stringProp name="scriptLanguage">groovy</stringProp>
</JSR223PostProcessor>
<hashTree/>
</hashTree>
<DebugSampler guiclass="TestBeanGUI" testclass="DebugSampler" testname="Debug Sampler-${NEW_VAR}" enabled="true">
<boolProp name="displayJMeterProperties">false</boolProp>
<boolProp name="displayJMeterVariables">true</boolProp>
<boolProp name="displaySystemProperties">false</boolProp>
</DebugSampler>
<hashTree/>
</hashTree>
</hashTree>
</hashTree>
</jmeterTestPlan>
Basically, you should extract value of TOT_CHG into variable let's call it MY_VAR, create script (for example in BeanShell Pre- or PostProcessor) where you increase the value of variable, and use variable in the next request as ${MY_VAR}.