1、下载Jmeter源码包与二进制包
下载参考:https://www.cnblogs.com/ychun/p/15324797.html
教程所用:Jmeter5.0源码与二进制包
解压后
2、导入idea
3、导入jar包
1)选择JDK
2)将protocol加入到sources
3) 移除本身的jar导入二进制包里面的jar
导入,选择二进制压缩包 lib
应用
4、错误修改
1)缺少jar
解决
下载添加jar
地址:https://mvnrepository.com/artifact/org.bouncycastle/bcprov-jdk15on
导入jar(添加-勾选-应用)
5、尝试运行
ctrl+N 寻找 NewDriver.java , 并run
6、再次报错后解决
D: 2toolsjavainjava.exe "-javaagent:D: 2toolsIntelliJ IDEA 2020.2.2libidea_rt.jar=61815:D: 2toolsIntelliJ IDEA 2020.2.2in" -Dfile.encoding=UTF-8 -classpath D: 2toolsjavajrelibcharsets.jar;D: 2toolsjavajrelibdeploy.jar;D: 2toolsjavajrelibextaccess-bridge-64.jar;D: 2toolsjavajrelibextcldrdata.jar;D: 2toolsjavajrelibextdnsns.jar;D: 2toolsjavajrelibextjaccess.jar;D: 2toolsjavajrelibextjfxrt.jar;D: 2toolsjavajrelibextlocaledata.jar;D: 2toolsjavajrelibext ashorn.jar;D: 2toolsjavajrelibextsunec.jar;D: 2toolsjavajrelibextsunjce_provider.jar;D: 2toolsjavajrelibextsunmscapi.jar;D: 2toolsjavajrelibextsunpkcs11.jar;D: 2toolsjavajrelibextzipfs.jar;D: 2toolsjavajrelibjavaws.jar;D: 2toolsjavajrelibjce.jar;D: 2toolsjavajrelibjfr.jar;D: 2toolsjavajrelibjfxswt.jar;D: 2toolsjavajrelibjsse.jar;D: 2toolsjavajrelibmanagement-agent.jar;D: 2toolsjavajrelibplugin.jar;D: 2toolsjavajrelib esources.jar;D: 2toolsjavajrelib t.jar;D: epositorysource estapache-jmeter-5.0classesproductionapache-jmeter-5.0_2;D: epositorysource estapache-jmeter_binarylibasm-6.1.jar;D: epositorysource estapache-jmeter_binarylibdarcula.jar;D: epositorysource estapache-jmeter_binarylibjorphan.jar;D: epositorysource estapache-jmeter_binarylibsf-2.4.0.jar;D: epositorysource estapache-jmeter_binarylibsh-2.0b6.jar;D: epositorysource estapache-jmeter_binarylibshclient.jar;D: epositorysource estapache-jmeter_binarylibdec-0.1.2.jar;D: epositorysource estapache-jmeter_binaryliboro-2.0.8.jar;D: epositorysource estapache-jmeter_binarylibjtidy-r938.jar;D: epositorysource estapache-jmeter_binarylibjunit-4.12.jar;D: epositorysource estapache-jmeter_binarylibxalan-2.7.2.jar;D: epositorysource estapache-jmeter_binarylibjsoup-1.11.2.jar;D: epositorysource estapache-jmeter_binarylibph-css-6.1.1.jar;D: epositorysource estapache-jmeter_binarylib hino-1.7.10.jar;D: epositorysource estapache-jmeter_binarylibdnsjava-2.1.8.jar;D: epositorysource estapache-jmeter_binarylibjcharts-0.7.5.jar;D: epositorysource estapache-jmeter_binarylibcaffeine-2.6.2.jar;D: epositorysource estapache-jmeter_binarylibcommons-io-2.6.jar;D: epositorysource estapache-jmeter_binarylibhttpmime-4.5.6.jar;D: epositorysource estapache-jmeter_binarylibjodd-log-4.1.4.jar;D: epositorysource estapache-jmeter_binarylibjson-smart-2.3.jar;D: epositorysource estapache-jmeter_binarylibmail-1.5.0-b01.jar;D: epositorysource estapache-jmeter_binarylib ika-core-1.18.jar;D: epositorysource estapache-jmeter_binarylibxstream-1.4.10.jar;D: epositorysource estapache-jmeter_binarylibcommons-net-3.6.jar;D: epositorysource estapache-jmeter_binarylibhttpcore-4.4.10.jar;D: epositorysource estapache-jmeter_binarylibjodd-core-4.1.4.jar;D: epositorysource estapache-jmeter_binarylibjson-path-2.4.0.jar;D: epositorysource estapache-jmeter_binarylibxml-apis-1.4.01.jar;D: epositorysource estapache-jmeter_binarylibxmlpull-1.1.3.1.jar;D: epositorysource estapache-jmeter_binarylibxpp3_min-1.1.4c.jar;D: epositorysource estapache-jmeter_binarylibhttpclient-4.5.6.jar;D: epositorysource estapache-jmeter_binarylibjodd-props-4.1.4.jar;D: epositorysource estapache-jmeter_binaryliblog4j-api-2.11.0.jar;D: epositorysource estapache-jmeter_binarylibph-commons-9.1.2.jar;D: epositorysource estapache-jmeter_binarylibserializer-2.7.2.jar;D: epositorysource estapache-jmeter_binarylibslf4j-api-1.7.25.jar;D: epositorysource estapache-jmeter_binarylibslf4j-ext-1.7.25.jar;D: epositorysource estapache-jmeter_binarylibcommons-jexl3-3.1.jar;D: epositorysource estapache-jmeter_binarylibcommons-lang3-3.8.jar;D: epositorysource estapache-jmeter_binarylibfreemarker-2.3.28.jar;D: epositorysource estapache-jmeter_binarylibgroovy-all-2.4.15.jar;D: epositorysource estapache-jmeter_binarylibhamcrest-core-1.3.jar;D: epositorysource estapache-jmeter_binaryliblog4j-core-2.11.0.jar;D: epositorysource estapache-jmeter_binarylibSaxon-HE-9.8.0-12.jar;D: epositorysource estapache-jmeter_binarylib ika-parsers-1.18.jar;D: epositorysource estapache-jmeter_binarylibxercesImpl-2.11.0.jar;D: epositorysource estapache-jmeter_binarylibcommons-codec-1.11.jar;D: epositorysource estapache-jmeter_binarylibcommons-jexl-2.1.1.jar;D: epositorysource estapache-jmeter_binarylibjodd-lagarto-4.1.4.jar;D: epositorysource estapache-jmeter_binarylibaccessors-smart-1.2.jar;D: epositorysource estapache-jmeter_binarylibcommons-dbcp2-2.4.0.jar;D: epositorysource estapache-jmeter_binarylibcommons-math3-3.6.1.jar;D: epositorysource estapache-jmeter_binarylibcommons-pool2-2.6.0.jar;D: epositorysource estapache-jmeter_binarylibhamcrest-date-2.0.4.jar;D: epositorysource estapache-jmeter_binarylibhttpcore-nio-4.4.10.jar;D: epositorysource estapache-jmeter_binaryliblog4j-1.2-api-2.11.0.jar;D: epositorysource estapache-jmeter_binarylibhttpasyncclient-4.1.3.jar;D: epositorysource estapache-jmeter_binarylibjcl-over-slf4j-1.7.25.jar;D: epositorysource estapache-jmeter_binarylib syntaxtextarea-2.6.1.jar;D: epositorysource estapache-jmeter_binarylibjavax.activation-1.2.0.jar;D: epositorysource estapache-jmeter_binaryliblog4j-slf4j-impl-2.11.0.jar;D: epositorysource estapache-jmeter_binarylibxmlgraphics-commons-2.2.jar;D: epositorysource estapache-jmeter_binarylibmongo-java-driver-2.11.3.jar;D: epositorysource estapache-jmeter_binarylibcommons-collections-3.2.2.jar;D: epositorysource estapache-jmeter_binarylibjavax.activation-api-1.2.0.jar;D: epositorysource estapache-jmeter_binarylibgeronimo-jms_1.1_spec-1.1.1.jar;C:UsersliyujiaoDesktopcutil-jdk15on-1.69.jar;C:UsersliyujiaoDesktopcpkix-jdk15on-1.69.jar;C:UsersliyujiaoDesktopcprov-ext-jdk15on-1.69.jar;C:UsersliyujiaoDesktopcmail-jdk15on-1.69.jar org.apache.jmeter.NewDriver java.lang.Throwable: Could not access D: epositorysource estlib at org.apache.jmeter.NewDriver.<clinit>(NewDriver.java:102) java.lang.Throwable: Could not access D: epositorysource estlibext at org.apache.jmeter.NewDriver.<clinit>(NewDriver.java:102) java.lang.Throwable: Could not access D: epositorysource estlibjunit at org.apache.jmeter.NewDriver.<clinit>(NewDriver.java:102) ERROR StatusLogger Unable to access file:/D:/repository/source/test/bin/log4j2.xml java.io.FileNotFoundException: D: epositorysource estinlog4j2.xml (系统找不到指定的路径。) at java.io.FileInputStream.open0(Native Method) at java.io.FileInputStream.open(FileInputStream.java:195) at java.io.FileInputStream.<init>(FileInputStream.java:138) at java.io.FileInputStream.<init>(FileInputStream.java:93) at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:90) at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:188) at java.net.URL.openStream(URL.java:1045) at org.apache.logging.log4j.core.config.ConfigurationSource.fromUri(ConfigurationSource.java:247) at org.apache.logging.log4j.core.config.ConfigurationFactory$Factory.getConfiguration(ConfigurationFactory.java:404) at org.apache.logging.log4j.core.config.ConfigurationFactory$Factory.getConfiguration(ConfigurationFactory.java:346) at org.apache.logging.log4j.core.config.ConfigurationFactory.getConfiguration(ConfigurationFactory.java:260) at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:615) at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:636) at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:231) at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:153) at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:45) at org.apache.logging.log4j.LogManager.getContext(LogManager.java:194) at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getContext(AbstractLoggerAdapter.java:121) at org.apache.logging.slf4j.Log4jLoggerFactory.getContext(Log4jLoggerFactory.java:43) at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:46) at org.apache.logging.slf4j.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:29) at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:358) at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:383) at org.apache.jmeter.JMeter.<clinit>(JMeter.java:122) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at java.lang.Class.newInstance(Class.java:442) at org.apache.jmeter.NewDriver.main(NewDriver.java:243) ERROR StatusLogger Reconfiguration failed: No configuration found for '18b4aac2' at 'null' in 'null' 15:06:51.316 [main] ERROR org.apache.jmeter.JMeter - An error occurred: java.lang.RuntimeException: Could not read JMeter properties file:D: epositorysource estinjmeter.properties at org.apache.jmeter.util.JMeterUtils.loadJMeterProperties(JMeterUtils.java:209) ~[apache-jmeter-5.0_2/:?] at org.apache.jmeter.JMeter.initializeProperties(JMeter.java:771) ~[apache-jmeter-5.0_2/:?] at org.apache.jmeter.JMeter.start(JMeter.java:453) [apache-jmeter-5.0_2/:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_161] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_161] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_161] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_161] at org.apache.jmeter.NewDriver.main(NewDriver.java:245) [apache-jmeter-5.0_2/:?] An error occurred: Could not read JMeter properties file:D: epositorysource estinjmeter.properties Process finished with exit code 1
修改 NewDriver.java
tmpDir = userDir.getAbsolutePath();
6、再次运行
成功
注意:
不要使用GUI模式进行加载测试!,仅用于测试创建和测试调试。对于负载测试,请使用NONGUI模式:jmemer-jmx文件[结果文件[Web报告文件夹路径]
我的ANT gradle版本