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