Hmmm, not sure it allowed my attachment, here is the xml file
<?xml version="1.0" encoding="UTF-8"?>
<jmeterTestPlan version="1.2" properties="2.4" jmeter="2.9 r1437961">
<hashTree>
<TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="plan
base" 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="errExample" enabled="true">
<stringProp
name="ThreadGroup.on_sample_error">stopthread</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">2</stringProp>
<stringProp name="ThreadGroup.ramp_time">15</stringProp>
<longProp name="ThreadGroup.start_time">1362057297000</longProp>
<longProp name="ThreadGroup.end_time">1362057297000</longProp>
<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">
http://www.theregister.co.uk/</stringProp>
<stringProp name="HTTPSampler.port"></stringProp>
<stringProp name="HTTPSampler.connect_timeout"></stringProp>
<stringProp name="HTTPSampler.response_timeout"></stringProp>
<stringProp name="HTTPSampler.protocol"></stringProp>
<stringProp name="HTTPSampler.contentEncoding"></stringProp>
<stringProp name="HTTPSampler.path"></stringProp>
<stringProp name="HTTPSampler.concurrentPool">4</stringProp>
</ConfigTestElement>
<hashTree/>
<CacheManager guiclass="CacheManagerGui" testclass="CacheManager"
testname="HTTP Cache Manager" enabled="true">
<boolProp name="clearEachIteration">false</boolProp>
<boolProp name="useExpires">false</boolProp>
</CacheManager>
<hashTree/>
<CookieManager guiclass="CookiePanel" testclass="CookieManager"
testname="HTTP Cookie Manager" enabled="true">
<collectionProp name="CookieManager.cookies"/>
<boolProp name="CookieManager.clearEachIteration">true</boolProp>
</CookieManager>
<hashTree/>
<RecordingController guiclass="RecordController"
testclass="RecordingController" testname="Recording Controller"
enabled="true"/>
<hashTree>
<HTTPSamplerProxy guiclass="HttpTestSampleGui"
testclass="HTTPSamplerProxy" testname="/2013/05/21/geeks_guide_bt_tower/"
enabled="true">
<elementProp name="HTTPsampler.Arguments"
elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments"
enabled="true">
<collectionProp name="Arguments.arguments"/>
</elementProp>
<stringProp name="HTTPSampler.domain"></stringProp>
<stringProp name="HTTPSampler.port">443</stringProp>
<stringProp name="HTTPSampler.connect_timeout"></stringProp>
<stringProp name="HTTPSampler.response_timeout"></stringProp>
<stringProp name="HTTPSampler.protocol">https</stringProp>
<stringProp name="HTTPSampler.contentEncoding"></stringProp>
<stringProp name="HTTPSampler.path">/</stringProp>
<stringProp name="HTTPSampler.method">GET</stringProp>
<boolProp name="HTTPSampler.follow_redirects">true</boolProp>
<boolProp name="HTTPSampler.auto_redirects">false</boolProp>
<boolProp name="HTTPSampler.use_keepalive">true</boolProp>
<boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
<boolProp name="HTTPSampler.monitor">false</boolProp>
<stringProp name="HTTPSampler.embedded_url_re"></stringProp>
</HTTPSamplerProxy>
<hashTree>
<HeaderManager guiclass="HeaderPanel" testclass="HeaderManager"
testname="HTTP Header Manager" enabled="true">
<collectionProp name="HeaderManager.headers">
<elementProp name="Accept-Language" elementType="Header">
<stringProp
name="Header.name">Accept-Language</stringProp>
<stringProp
name="Header.value">en-US,en;q=0.5</stringProp>
</elementProp>
<elementProp name="Accept" elementType="Header">
<stringProp name="Header.name">Accept</stringProp>
<stringProp
name="Header.value">text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8</stringProp>
</elementProp>
<elementProp name="User-Agent" elementType="Header">
<stringProp name="Header.name">User-Agent</stringProp>
<stringProp name="Header.value">Mozilla/5.0 (X11; Linux
x86_64; rv:17.0) Gecko/20130402 Firefox/17.0</stringProp>
</elementProp>
<elementProp name="Accept-Encoding" elementType="Header">
<stringProp
name="Header.name">Accept-Encoding</stringProp>
<stringProp name="Header.value">gzip, deflate</stringProp>
</elementProp>
</collectionProp>
</HeaderManager>
<hashTree/>
</hashTree>
<ResultCollector guiclass="SimpleDataWriter"
testclass="ResultCollector" testname="Simple Data Writer" 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>false</fieldNames>
<responseHeaders>false</responseHeaders>
<requestHeaders>false</requestHeaders>
<responseDataOnError>true</responseDataOnError>
<saveAssertionResultsFailureMessage>false</saveAssertionResultsFailureMessage>
<assertionsResultsToSave>0</assertionsResultsToSave>
<bytes>true</bytes>
</value>
</objProp>
<stringProp
name="filename">${__BeanShell(ctx.getThreadGroup().getName())}</stringProp>
</ResultCollector>
<hashTree/>
</hashTree>
</hashTree>
</hashTree>
</hashTree>
</jmeterTestPlan>
On 21 May 2013 23:25, Deepak Shetty <[email protected]> wrote:
> works fine for me in 2.9
> Whats your exact script and structure?
>
>
> On Tue, May 21, 2013 at 6:10 AM, Jason Wood <[email protected]> wrote:
>
> > Hi,
> >
> > I am trying to get the name of my threadgroup to use for logfile
> > creation. The advice
> > that I see from googling is to use
> >
> > ${__BeanShell(ctx.getThreadGroup().getName())}
> >
> > but this gives me
> >
> > 2013/05/21 14:05:26 INFO - jmeter.engine.StandardJMeterEngine: Running
> the
> > test!
> > 2013/05/21 14:05:26 ERROR - jmeter.util.BeanShellInterpreter: Error
> > invoking bsh method: eval Sourced file: inline evaluation of:
> > ``ctx.getThreadGroup().getName();''
> > 2013/05/21 14:05:26 WARN - jmeter.functions.BeanShell: Error running BSH
> > script org.apache.jorphan.util.JMeterException: Error invoking bsh
> method:
> > eval Sourced file: inline evaluation of:
> > ``ctx.getThreadGroup().getName();''
> > at
> >
> >
> org.apache.jmeter.util.BeanShellInterpreter.bshInvoke(BeanShellInterpreter.java:192)
> > at
> >
> >
> org.apache.jmeter.util.BeanShellInterpreter.eval(BeanShellInterpreter.java:198)
> > at org.apache.jmeter.functions.BeanShell.execute(BeanShell.java:103)
> > at
> >
> >
> org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.java:146)
> > at
> >
> >
> org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.java:120)
> > at
> >
> >
> org.apache.jmeter.testelement.property.FunctionProperty.getStringValue(FunctionProperty.java:92)
> > at
> >
> >
> org.apache.jmeter.testelement.AbstractTestElement.getPropertyAsString(AbstractTestElement.java:273)
> > at
> >
> >
> kg.apc.jmeter.reporters.FlexibleFileWriter.getFilename(FlexibleFileWriter.java:110)
> > at
> >
> >
> kg.apc.jmeter.reporters.FlexibleFileWriter.openFile(FlexibleFileWriter.java:187)
> > at
> >
> >
> kg.apc.jmeter.reporters.FlexibleFileWriter.testStarted(FlexibleFileWriter.java:78)
> > at
> >
> >
> org.apache.jmeter.engine.StandardJMeterEngine.notifyTestListenersOfStart(StandardJMeterEngine.java:209)
> > at
> >
> >
> org.apache.jmeter.engine.StandardJMeterEngine.run(StandardJMeterEngine.java:325)
> > at java.lang.Thread.run(Thread.java:662)
> > Caused by: java.lang.reflect.InvocationTargetException
> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > at
> >
> >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> > at
> >
> >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> > at java.lang.reflect.Method.invoke(Method.java:597)
> > at
> >
> >
> org.apache.jmeter.util.BeanShellInterpreter.bshInvoke(BeanShellInterpreter.java:171)
> > ... 12 more
> > Caused by: Sourced file: inline evaluation of:
> > ``ctx.getThreadGroup().getName();'' : at Line: 1 : in file: inline
> > evaluation of: ``ctx.getThreadGroup().getName();'' : .getName ( )
> >
> >
> >
> > I am using JMeter 2.9. I have poked around in the src and found that
> > context has a virtual getThreadGroup() method so am wondering if whatever
> > is supposed
> > to be supplying it is in error. Randomly calling other methods of
> > JMeterContext such as getThread() don't cause an error (but obviously
> don't
> > return what
> > I want to generate a filename).
> >
> > I presume this used to work . . .
> >
> > --
> > ------------------------------
> > jason
> >
>
--
------------------------------
jason