JMeter calls external files
Call an external java file
Source ("D:\\ lr\\ jmeter\ MD5.java")
/ / source ("MD5.java"); relative path. Files are located in the jmeter bin directory.
String strMd5 = MD5.GetMD5Code ("123456")
Log.info ("1111 =" + strMd5)
Vars.put ("ddd", strMd5)
String eee = vars.get ("ddd")
Log.info ("eee=" + eee)
Use this variable:
two。 Call an external class file
AddClassPath ("directory where the class file is located")
Import class name
AddClassPath ("D:\\ lr\\ jmeter")
Import MD5
String strMd5 = MD5.GetMD5Code ("123456")
Log.info (strMd5)
Vars.put ("aaa", strMd5)
String bbb = vars.get ("aaa")
Log.info (bbb)
Use this variable:
3. Call an external jar package
Import the jar package in the test plan, or place the jar package in the jmeter lib directory ahead of time and restart
Import class name
Import com.util.MD5
String ccc = MD5.GetMD5Code ("123456")
Log.info (ccc)
Vars.put ("ddd", ccc)
String eee = vars.get ("ddd")
Log.info (eee)
Use this variable: