JMeter in BeanShell sampler debug sharing

Source: Internet
Author: User
Tags vars

BeanShell Script

" s "  "y"= s.equals (y); Vars.put ("result2 ", result);

By looking at the result tree, BeanShell the foot of the newspaper wrong

By Youdao Translator, means the method call error

Which method calls the error?

Error in method invocation by exception Discovery: method Put (java.lang.String, Boolean) not found in class ' org.apache.jmeter.t Hreads. Jmetervariables '

There should be no way to find the put (Java.lang.String, Boolean).

The bold guess is that the put value should be string. Validation conjecture:

Modify the code as follows:

" s "  "y"= s.equals (y); Vars.put ("result " , result.tostring ()); Type is converted to string
int I=integer.parseint (a); string-to-integer //vars.put ("result2", result); System. out. println (VARs.Get("result"));

Because the SYSTEM.OUT.PRINTLN statement is used for printing, the cmd window displays debug information

By Youdao Translator, means the method call error

Expand the knowledge point:

String s ="s"; String y="y"; Boolean result=s.equals (y); Vars.put ("result", result.tostring ());//vars.put ("result2", result);Log.info ("Agoly"); Write the log information to the Jmeter.log file to system. out. println (VARs.Get("result")); Log.info ("The result of RESULT1 is"+vars.Get("result")); Log.info ("The result of RESULT2 is"+result);

JMeter in BeanShell sampler debug sharing

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.