0

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

Lucky
  • 11
  • 7

1 Answers1

0

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.

Dmitri T
  • 159,985
  • 5
  • 83
  • 133
  • Thanks Dmitri, I tried the above one and after lots of errors and adding all the required JAR files, It got executed. But not getting any output in the response i am getting "class OAuth". Not sure what this means it is successful or not. Trying to debug it now, if you know how to please let me know. Thanks Again – Lucky Dec 30 '15 at 11:24
  • Still not able to get the output msg "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"". I am getting only "class oauth.sample.OAuth" – Lucky Dec 30 '15 at 13:21
  • Most likely there is a problem with your script or formatting. Check jmeter.log file for any clues – Dmitri T Dec 31 '15 at 06:23