在查看结果树中,我看不到任何发出的http请求。相反,它仅在请求正文下显示null。使用邮递员作品进行测试,并使用maven命令运行jmeter也可以。运行指向我的本地服务器的Jmeter也可以。在我的同事电脑上也可以。
但是,如果我使用计算机向远程服务器发出http请求,那么它只会显示空请求。
截屏到远程服务器
截屏到我的本地主机
2019-08-05 14:50:13,951 INFO o.a.j.e.StandardJMeterEngine: Running the test!
2019-08-05 14:50:13,952 INFO o.a.j.s.SampleEvent: List of sample_variables: []
2019-08-05 14:50:13,953 INFO o.a.j.g.u.JMeterMenuBar: setRunning(true, *local*)
2019-08-05 14:50:13,956 INFO o.a.j.e.StandardJMeterEngine: Starting setUp thread groups
2019-08-05 14:50:13,957 INFO o.a.j.e.StandardJMeterEngine: Starting setUp ThreadGroup: 1 : 100 - buildings-login
2019-08-05 14:50:13,957 INFO o.a.j.e.StandardJMeterEngine: Starting 1 threads for group 100 - buildings-login.
2019-08-05 14:50:13,957 INFO o.a.j.e.StandardJMeterEngine: Thread will continue on error
2019-08-05 14:50:13,957 INFO o.a.j.t.ThreadGroup: Starting thread group... number=1 threads=1 ramp-up=1 delayedStart=false
2019-08-05 14:50:13,959 INFO o.a.j.t.ThreadGroup: Started thread group number 1
2019-08-05 14:50:13,959 INFO o.a.j.e.StandardJMeterEngine: Waiting for all setup thread groups to exit
2019-08-05 14:50:13,959 INFO o.a.j.t.JMeterThread: Thread started: 100 - buildings-login 1-1
2019-08-05 14:50:13,959 INFO o.a.j.s.FileServer: Stored: buildings-enos-wrapper-config-wrapper-parameter.csv
2019-08-05 14:50:13,959 INFO o.a.j.s.FileServer: Stored: buildings-enos-wrapper-config-server-parameter.csv
2019-08-05 14:50:13,959 ERROR o.a.j.u.BeanShellInterpreter: Error invoking bsh method: eval Sourced file: inline evaluation of: ``${access_token};'' : Attempt to access property on undefined variable or class name
2019-08-05 14:50:13,959 WARN o.a.j.e.BeanShellPostProcessor: Problem in BeanShell script: org.apache.jorphan.util.JMeterException: Error invoking bsh method: eval Sourced file: inline evaluation of: ``${access_token};'' : Attempt to access property on undefined variable or class name
2019-08-05 14:50:13,959 INFO o.a.j.t.JMeterThread: Thread is done: 100 - buildings-login 1-1
2019-08-05 14:50:13,959 INFO o.a.j.t.JMeterThread: Thread finished: 100 - buildings-login 1-1
2019-08-05 14:50:13,959 INFO o.a.j.e.StandardJMeterEngine: All Setup Threads have ended
2019-08-05 14:50:14,037 INFO o.a.j.e.StandardJMeterEngine: Starting ThreadGroup: 1 : 200 - buildings-wrapper
2019-08-05 14:50:14,037 INFO o.a.j.e.StandardJMeterEngine: Starting 1 threads for group 200 - buildings-wrapper.
2019-08-05 14:50:14,037 INFO o.a.j.e.StandardJMeterEngine: Thread will continue on error
2019-08-05 14:50:14,037 INFO o.a.j.t.ThreadGroup: Starting thread group... number=1 threads=1 ramp-up=1 delayedStart=false
2019-08-05 14:50:14,037 INFO o.a.j.t.ThreadGroup: Started thread group number 1
2019-08-05 14:50:14,037 INFO o.a.j.e.StandardJMeterEngine: All thread groups have been started
2019-08-05 14:50:14,037 INFO o.a.j.t.JMeterThread: Thread started: 200 - buildings-wrapper 1-1
2019-08-05 14:50:14,068 INFO o.a.j.t.JMeterThread: Thread is done: 200 - buildings-wrapper 1-1
2019-08-05 14:50:14,068 INFO o.a.j.t.JMeterThread: Thread finished: 200 - buildings-wrapper 1-1
2019-08-05 14:50:14,068 INFO o.a.j.e.StandardJMeterEngine: Notifying test listeners of end of test
2019-08-05 14:50:14,068 INFO o.a.j.s.FileServer: Close: buildings-enos-wrapper-config-server-parameter.csv
2019-08-05 14:50:14,068 INFO o.a.j.s.FileServer: Close: buildings-enos-wrapper-config-wrapper-parameter.csv
2019-08-05 14:50:14,068 INFO o.a.j.g.u.JMeterMenuBar: setRunning(false, *local*)
答案 0 :(得分:2)
上周我发生了同样的事情。我通过从“服务器名称或IP”字段中删除任何正斜杠并将它们移至“路径”字段来解决了该问题。 因此,如果将“ www.example.com/foo/”作为服务器名称,则需要将“ / foo /”部分移至路径。
答案 1 :(得分:1)
您正在创建无效的HTTP请求,并为发布请求发送空的请求正文
使用此链接,以使用JMeter进行正确的HTTP请求
https://www.testingexcellence.com/jmeter-tutorial-testing-rest-web-services/
答案 2 :(得分:1)
在ubuntu计算机上安装openjdk 8版本时,JMeter测试失败,并返回空请求。似乎2019年7月31日openjdk中的最新更新打破了在IP字段中使用/的jmeter功能。我想返回旧版本的openjdk 8,但是不可能,所以我安装了openjdk 11.0.2版本(11.0.4的早期版本),然后转发测试集,这些测试集的网址在“服务器名称或IP”中带有斜杠领域。 https://download.java.net/java/GA/jdk11/9/GPL/openjdk-11.0.2_linux-x64_bin.tar.gz。
为此,我为Apache coomunity开了一个问题: https://bz.apache.org/bugzilla/show_bug.cgi?id=63637
答案 3 :(得分:0)
查看以下几行:
2019-08-05 14:50:13,959错误oajuBeanShellInterpreter:调用bsh方法时出错:eval源文件:
${access_token};'' : Attempt to access property on undefined variable or class name 2019-08-05 14:50:13,959 WARN o.a.j.e.BeanShellPostProcessor: Problem in BeanShell script: org.apache.jorphan.util.JMeterException: Error invoking bsh method: eval Sourced file: inline evaluation of:
$ {access_token};的内联求值:'':尝试访问未定义变量的属性或班级名称
如果您以编程方式构建请求,则Beanshell测试元素似乎无法正常工作-请仔细查看Beanshell脚本并进行修复。
前进:
${access_token}
更改为vars.get("access_token")
,其中 vars 是JMeterVariables类实例的简写。请查看Top 8 JMeter Java Classes You Should Be Using with Groovy文章,以获取有关JSR223测试元素中可用的JMeter API速记的更多信息。