0
votes

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.

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

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. Key
  2. Secret Key

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

  1. request Payload
  2. Email
  3. Status

without these the request will fail.

My output code looks like the below in Eclipse:-

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"

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 Plugin

1

1 Answers

0
votes

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

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

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.

Groovy and JMeter

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