JMeter referencing jar external files

Source: Internet
Author: User

One: Write code in Java first

This need to encrypt the parameters, the other files need to refer to the direct reference; not write directly to the Java programmer to give you code, copy to your program can (#^.^#)

1.1: Set up a class, the need to dynamically join the value as a parameter passed, after processing can get the value after encryption

Note: All the files are under "Encrypt", this will be used in JMeter

1.2: After writing, in the program using the main method to run an article, did not ask him after the jar package

1.3: Start generating JAR file

1.4: Click Next

1.5: Click Finish directly to finish, you can

Two: Start JMeter

2.1: New test plan, create new thread, add BeanShell Sampler

Note: Before writing in script in BeanShell Sampler, to see if there are no newly exported jar files in JMeter below Lib/ext, if not manually assigned.

There are many ways to introduce, I only use this one today, I feel more convenient

2.2: Make sure the file has been placed under Lib/ext, then start writing code reference

Note: Here the System.out.println ("############### #开始 #######################") is not displayed in Log-viewer

2.3: Want to know if there is success in the introduction, or save the variable has the wood to be successful, add a debug Sampler, view

24: A method that references success and also succeeds in invoking the jar inside

Three: Errors encountered

3.1: In the Write BeanShell sampler call Method-Write a new start to appear an error, I put tea this class, it new out, the results of the error when running, the error message is as follows:

Error Result:

It's time to remove new and run it again. There is no need for a new object, and the method itself is a static method that can be called directly from the class name.

The last time the use of the call was successful, but after a few months useless and forget, in the Internet has been looking for, and finally decided to record their own impression of a more profound (#^.^#).

JMeter referencing jar external files

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.