Forum: Ruby JSR223+Ruby Not able to get JMeter Variables in Ruby JSR223

Posted by Muthu K. (muthu_k)
on 2013-02-18 13:10
Hi all,

I have below question in JRuby .. .even when i was selecting and running
with Ruby the same issue is occuring .. Please find below link for
detailed issues


http://www.ruby-forum.com/topic/4410991#new

Issue is that


Jmeter Variable Defined:
InputFilePath="somevalue"

Jruby Code used :
begin
sprovider_url=$vars.get("InputFilePath")
puts " args sprovider_url is #{sprovider_url} \n"

store_Obj=StoreRetrieve.new
rescue Exception =>e
puts " backtrace is #{e.backtrace}"
puts " Exception is #{e.message}"
end


Here InputFilePath is the  User Variable defined in Jmeter with
somevalue as stated above...

I ran with 5 threads

Output:
   [jmeter]  args sprovider_url is /path/filename.txt
   [jmeter]  backtrace is ["<script>:1:in `(root)'"]
   [jmeter]  backtrace is ["<script>:1:n `(root)'"]
   [jmeter]  Exception is undefined method `[]' for nil:NilClass
   [jmeter]  Exception is undefined method `[]' for nil:NilClass
   [jmeter]  backtrace is ["<script>:1:in `(root)'"]
   [jmeter]  Exception is undefined method `[]' for nil:NilClass
   [jmeter]  backtrace is ["<script>:1:in `(root)'"]
   [jmeter]  Exception is undefined method `[]' for nil:NilClass


Could you guys please help me here?  How to get $vars consistently in
Ruby...if i use any other scripting lanuages ..like  Javascript , Jexl
i am not getting this failure...
Posted by Muthu K. (muthu_k)
on 2013-02-23 20:00
Hi guys,

Please reply to this question.. as it looks like RUBY problem ... i was
expecting some answer which guide me to resolve this issue
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.