How to invoke the Java toolkit that you wrote in JMeter

Source: Internet
Author: User
Tags vars

This article describes calling your own Java Toolkit in JMeter, not directly inheriting the Java sample request interface provided by JMeter.

Tools/Materials
    • Jmeter
    • Eclipse
Method/Step
  1. When using JMeter as an HTTP request (or other type), it is sometimes necessary to do a specific processing of the requested data (or the data in response), such as encryption and decryption.
  2. We can use Java to write some tool classes, use the BeanShell provided by JMeter to call our tool class to process the data, and then make the related request.
  3. First write a tool class in Eclipse, I wrote a tool class Getstringwithlbrb.java that intercepts strings based on the left and right boundaries, "select" All of your class files that you write, "click" Select Export, "Export" jar package (casually named, Remember the package path for this class in eclipse)
  4. Then put the exported jar package into the \apache-jmeter-2.12\lib\ext directory, create a project in JMeter, add an HTTP request, and in this request we add a pre-BeanShell.
  5. Importing our Jar packages in BeanShell (the path that we see in Eclipse), the two methods in BeanShell are the most commonly used: Vars.get (String paramstr), Vars.put (string key , String value), the previous one obtains the value of the variable from JMeter, and the latter is the data stored in the JMeter variable.
  6. Show me Abc123def the string 123 and then save it to jmeter so I can use ${paramname in jmeter to get my processed value.
  7. So for the request before the encryption, the request to decrypt the situation, we can write our own toolkit for related data processing

How to invoke the Java toolkit that you wrote in JMeter

Related Article

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.