Using JMeter to implement a call to a jar package

Source: Internet
Author: User
I. Preface

In the process of testing the interface, it may sometimes be necessary to use a third-party jar package to generate some test data (such as sometimes need to use a third-party jar to encrypt the input values of the parameters), the common practice is to manually call the jar package to get the desired value, The values are then assigned to one of the parameters in the JMeter. This is tedious, and JMeter has the ability to invoke the jar package, which we can use to implement embedded calls to the jar package.

Below we will write a simple cryptographic program and then implement the call to this jar package. Two. Operation Procedure

1. Write a simple encryption message, the content is as follows (where the hex packet is an algorithm package, can not find the words to write a small algorithm instead);


2, select the program, then right-click "Export", in the pop-up screen select the export mode as "JAR file", click "Next"


3. In the next step, select the output resource mode, file storage path and file name


4. Put the exported jar package and the Tea-hex-1.0.jar file required by the previous project into the Lib/ext of the JMeter folder for easy management


5. Create a new test script and import the generated jar package under the test plan


6. Add a sampler, the path is "thread group----ADD----Sampler----Bean Shell Sampler"


7. Write the Java code under the Bean Shell Sampler, implement the call to the jar package, and assign the encrypted content to Mypara (the statement usage please Baidu, the tutorial is very much)


8. Mypara the assigned parameter to another interface reference


9. Add "View results tree" To view the call situation



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.