Jmeter OAuth 1.0请求 [英] Jmeter OAuth 1.0 Request

查看:191
本文介绍了Jmeter OAuth 1.0请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用于OAuth 1.0身份验证的Java代码,每次我必须在测试每个请求之前执行它.我目前正在开发JSR223采样器.

I have a Java code for OAuth 1.0 Authentication and each time i have to execute it before testing each request. I am currently working on JSR223 sampler.

但是碰巧看到这个OAuth 1.0插件,有人可以解释一下屏幕快照中基于OAuth 1.0的身份验证的工作原理.

But happen to see this OAuth 1.0 Plugin, can someone explain me how this OAuth 1.0 based Authentication in the screenshot works.

在下面给出的每个请求的Authorization标头输出示例中,我将传递一些参数值.

I have some parameter value to be passed in the Authorization header output example given below for each request.

对于第一个网址,我有两个参数

For the first URL, I have two parameter

  1. 秘密密钥

分别为第二个URL和第二个URL提供访问令牌和秘密访问令牌

Which give the Access token and secret access token for the Second URL and for the third it will add

  1. 请求有效载荷
  2. 电子邮件
  3. 状态

没有这些请求的请求将失败.

without these the request will fail.

我的输出代码在Eclipse中如下所示:-

My output code looks like the below in Eclipse:-

授权:OAuth oauth_signature =动态值",scope =参数值",oauth_version =动态值",oauth_nonce =动态值",oauth_signature_method = HMAC-SHA1,oauth_consumer_key =参数值",oauth_token =动态值",oauth_timestamp =动态值"

Authorization :OAuth oauth_signature="Dynamic Value",scope="Parameter Value",oauth_version="Dynamic Value",oauth_nonce="Dynamic Value",oauth_signature_method=HMAC-SHA1,oauth_consumer_key="Parameter Value",oauth_token="Dynamic Value",oauth_timestamp="Dynamic Value"

有没有办法直接用Jmeter中的所有Jar文件运行这段Java代码[不做任何更改]?

Is there a way that i run the piece of Java code directly with all the Jar files in Jmeter [without doing any changes] is that possible?

OAuth 1.0插件

推荐答案

我建议将OAuth客户端库添加到JMeter的类路径(只需将它们拖放到JMeter安装的/lib文件夹中)

I would suggest adding OAuth client libraries to JMeter's classpath (just drop them to /lib folder of your JMeter installation)

还要下载 groovy-all.jar 的最新版本.并将其放在相同的/lib文件夹中.重新启动JMeter来拾取罐子.

Also download the latest version of groovy-all.jar and put it to the same /lib folder. Restart JMeter to pick the jars up.

然后将 JSR223采样器添加到您的测试计划中,选择常规"在语言"下拉菜单中,然后将Java代码放入脚本"区域.在99%的情况下,有效的Java代码将是有效的Groovy代码,因此您可以通过这种方式运行它.

Then add JSR223 Sampler to your Test Plan, choose "groovy" in "Language" drop-down and put your Java code to "Script" area. Valid Java code in 99% of cases will be valid Groovy code so you can run it this way.

请参见如何在受保护的OAuth上运行性能测试带有JMeter的应用可以提供有关该域的更多详细信息的指南.

See How to Run Performance Tests on OAuth Secured Apps with JMeter guide for more detailed information on the domain.

这篇关于Jmeter OAuth 1.0请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆