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

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

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)

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 pre-processed variable as part of report file name

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

Trying to do App Authenticity and during client.connect() getting "App authenticity security check failed"

Hi I am trying to connect to production server and do App authenticity (native android app). But I Am getting following error "App authenticity security check failed".
What I am doing at MFP project level.
In authconfig xml.
<customSecurityTest name="AuthSecurityTest">
<test realm="wl_antiXSRFRealm" step="1" />
<test realm="wl_authenticityRealm" step="1" />
<test realm="wl_remoteDisableRealm" step="1" />
<test isInternalUserID="true" realm="AuthRealm" step="1" />
<test realm="wl_deviceNoProvisioningRealm" isInternalDeviceID="true"
step="2" />
</customSecurityTest>
<realm loginModule="AuthLoginModule" name="AuthRealm">
<className>com.worklight.integration.auth.AdapterAuthenticator</className>
<parameter name="login-function" value="AuthAdapter.onAuthRequired" />
<parameter name="logout-function" value="AuthAdapter.onLogout" />
</realm>
<loginModule name="AuthLoginModule">
<className>com.worklight.core.auth.ext.NonValidatingLoginModule</className>
</loginModule>
My application descriptor :
<nativeAndroidApp xmlns="http://www.worklight.com/native-android-descriptor"
id="MFP_Android"
platformVersion="7.1.0.00.20160401-2103" securityTest="AuthSecurityTest" version="1.0">
<displayName>MFP_Android</displayName>
<description>MFP_Android</description>
<accessTokenExpiration>3600</accessTokenExpiration>
<publicSigningKey>MIIBHSAKJHDFKJHFKHDFKJHDKJHDFSKJHFDSKJHFDSKJDFHKJDFHDFHJDSKDFSHKDJFSHKJFDHSKJDFSHKJDFSHKJDFSHKJDFHSKJDFHlkasalJAscnmxzcncxmnzksjdadskjdsjsdjskjdksjdakjdssdjksdaj</publicSigningKey>
<packageName>com.mfp</packageName>
<targetCategory>UNDEFINED</targetCategory>
<licenseAppType>APPLICATION</licenseAppType>
</nativeAndroidApp>
I am calling the challenge hander on connect.
AndroidChallengeHandler challengeHandler = new AndroidChallengeHandler("AuthRealm");
WLClient client;
client.registerChallengeHandler(challengeHandler);
client.connect();
I am getting response as
/*-secure- {"reason":"App authenticity security check failed"}*/
y would I get such response.
I find it very strange that your package name is really "com.mfp" as seen in the descriptor XML file: <packageName>com.mfp</packageName>.
Are you absolutely sure this is your package name (that you can find in the AndroidManifest.xml file of your Android native project)?
Another possibility is that the key used to in the descriptor XML file does not match the key that was used to sign the .apk with.
Lastly, this could be due to the steps that you've defined in the Authentication Configuration XML file. Try changing the "wl_remoteDisableRealm" to be "step 2". This change will require you to re-deploy the updated .war file to your application server.

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}.