3

In my project there is a scenario that

user will log in -> browse some pages -> then he will click on the logout link .

to test this scenario in JMeter, I used CSV config so that I can test this scenario for 50 users. during logout, each user unique userid is sent as request in the MD5 format.

How can I sent the userid in MD5 format in JMeter?

Ori Marko
  • 56,308
  • 23
  • 131
  • 233
Neil
  • 43
  • 1
  • 6
  • wait wait, you want to "mock" the service response? I'm confused can you re-phrase? or am I getting it right? – ant Jun 26 '12 at 08:15
  • what i want to mean is , under thread group i add a common csv config element ,that csv contains the user details . – Neil Jun 26 '12 at 09:16
  • aha good. and what do you want to do with those details? – ant Jun 26 '12 at 09:18
  • what i want to mean is , under thread group i add a common csv config element ,that csv contains the user details . now i add a simple controller under thread group , i gave the controller name " login" . now under the controller login there is the http request for login.in that http request parameter i sent the username and passoword dynamically using variable[ ${username} ,&{password}. now in the logout section http request , userid of each user is sent in the md5 format. so what i want to know that how can i sent the userid in md5 format during logout. h – Neil Jun 26 '12 at 09:23
  • here i want to mention one point that in the user csv there was also a column userid , so can i use that field here. – Neil Jun 26 '12 at 09:25
  • ant is it clear now , or you need some more information , if required please tell me , i will provide . – Neil Jun 26 '12 at 09:34
  • sorry wasn't here, you've got great answer both of them – ant Jun 26 '12 at 11:21

3 Answers3

2

You can easily use custom MD5 function from JMeter Plugins set.
This will look like ${__MD5(${username})}.

Here is also demo-script from plugin's author available, attached to conversation.

Aliaksandr Belik
  • 12,725
  • 6
  • 64
  • 90
  • i have tried the function ${__MD5(${username})} but it is not sending the userid in the md5 format properly and also the same userid is showing for all the users. – Neil Jun 26 '12 at 12:38
  • I've tried both original demo-script as well as modified one - the same but ${__MD5(${username})} is sent as param along with HTTP Request, not Dummy Sampler - works fine for me (Jmeter 2.7 + JmeterPLugins 0.5.3).Possibly something with your script... Try to look into jmeter.log for details. – Aliaksandr Belik Jun 26 '12 at 13:22
  • hi alies yes it is working correctly now . i havent installed jmeterplugins0.5.3 thats why it was not working previously , but after installation it is working correctly. thank you very much for the help . can you give me your any chat id or email add ,i need to clear 2 -3 things but here i am not able to post with screenshot ,that why i will talk with you over there. may be some very basic problem but i have not able to found solutions for those and stuck in the same point for prity long time. – Neil Jun 27 '12 at 06:14
0

You can grab the dynamic user/session ID using a regex, then calculate the MD5 using BeanShell preprocessor. Some sample code is available here and there.

Alex Balabanov
  • 581
  • 3
  • 11
  • i have tried the function ${__MD5(${username})} but it is not sending the userid in the md5 format properly and also the same userid is showing for all the users. – Neil Jun 26 '12 at 12:38
  • You need to add a BeanShell preprocessor into your script, implement the script for MD5 string processing and use it with your variables. – Alex Balabanov Jun 26 '12 at 13:58
  • 1
    Hi alexander , i have no knowledge in BeanShell preprocessor and programming , can you please provide any link from where i can learn this programming and how to use the processor in jmeter from the beginner point of view. will it also solve the problem related to jeson response where 2 subrequest of the parent request are par-allay running and in the view result tree in the response tab the response which is showing is not we are expecting? – Neil Jun 27 '12 at 06:27
0

Actually MD5 function was removed, use __digest with MD5 as first parameter instead:

${__digest(MD5,Errare humanum est,,,)}

returns c49f00b92667a35c63708933384dad52

Ori Marko
  • 56,308
  • 23
  • 131
  • 233