Handling Encrypted Response and Request - jmeter

With the tool Jmeter, I am facing some issues in that so I need help from you. The script which I have recorded, having all the values in the encrypted form of Boday data[POST] request. And the response is also in encrypted format. So I am not able to correlate and parameterize that values because only encrypted value is passing through request. Nothing else is passing in a request like plain text. Even If I implement the encryption algorithm then how to catch values from response?  Will you please take the time to look into this? How can it be solved?

Out of the box JMeter can only encrypt strings via __digest() function, if it supports the algorithm used by the application you're testing you will be able to use it for encryption of the request parameters.
With regards to decryption, you can add a JSR223 PostProcessor and implement the decryption logic in Groovy language. Once you perform the decryption you will be able to replace original (encrypted) response with the decrypted one, like:
byte [] encryptedResponse = prev.getResponseData()
// your code here to decrypt the response
prev.setResponseData(decryptedResponse)
and the decrypted data will be usable in other PostProcessors, Assertions and Listeners

Related

JMETER Performance Testing - Dynamic Payload

While doing performance testing via JMETER, I encountered one usecase where the POST request call is taking the dynamic data from the website. So in that case when we run our script it fails as that data is no more available on the website.
Payload looks like given below. It is a POST CALL and the payload is changing everytime.
{"marketId":"U-16662943","price":{"up":98,"down":100,"dec":"1.98"},"side":"HOME","line":0,"selectionids":["W2-1"]}
Could anyone suggest how we can make this payload dynamic when we create a script in JMETER?
I can think of 3 possible options:
Duplicate data is not allowed. If this is the case you can use JMeter Functions like __Random(), __RandomString(), __counter() and so on
The data you're sending needs to be aligned with the data in the application somehow, in this case you can use JDBC PreProcessor in order to build a proper request body basing on the data from the application under test database
The data is present in previous response. In that case it's a matter of simple correlation, the dynamic values should be extracted from the previous response using suitable Post-Processors and variables needs to be sent instead of hard-coded parameters

NiFi transfering data between processors

I want to create a simple flow. Firstly, I need to take accountIds from REST service and then use received values to create new HTTP request to get token, and then use this token to create some requests with Oauth2.
AccountIds flow:
From InvokeHttp I'll receive some ids in json (REST written in Java and returns List with Integers). 99% chance that there will be only one number. My response looks like: [40]. Now I need to replace square brackets and get this number (using SplitJson). This number I should put to the next getToken as one of the GET param (on a screenshot i hardcode this):
This will return a token. Token is a text/plain;charset=UTF-8. And then, i want to use InvokeHttp again, add atribute Authorization and add to this attribute Bearer + received token. I do not really understand how to use the received data from processors in the following processors. Can someone explain how to reach it with my flow?
The Rest Api provides you with payload body - in nifi terms a flowfile content, you need to parse that incoming content using an evaluatejson (if payload is json - in most cases) and store it in flow attributes.
Then this attributes will be used in the down stream processors.
Also to pass the Authorization to your InvokeHTTP you need to decalre it in the InvokeHTTP porcesor. The ${access_token} is from the upstream attributes extraction.

jmeter, regular expression extractor with parallel controller

Sorry for my poor English, and thank you in advance.
I'm trying to make a thread group that makes jmeter logged in our system.
to accomplish this, I need to POST data which contains ID, password, and token.
The token generated every time when the page has opened and hold in hidden value.
So, the usual solution which is like GET response, do the regular expression extractor, and make the value variable and POST it later request doesn't work for me.
since the token become different from when jmeter GET token and POST it.
Then, I found a parallel controller and this might be a solution for me.
but I can't find a way to do it.
also, there are no references in my mother language(Japanese).
I want POST token to certain login action so I need to do regular expression extractor with parallel controller.
then POST the token with ID and password at same time.
I want to know the way of the above or if it's impossible, is there any alternative solution that might work for me.
Thank you a lot for your help.
Don't worry about language at all :)
I will add a solution according to how I understand your problem.
As I understood, your scenario is,
We Request a page
We will get a response with token
We fetch the token and send the next request with the token
We will get a response with a different token
Need to fetch the new token and send another request
In this case, I think you are trying to use the first token in all the requests. Without doing that what if you fetch the token per each request?
The problem with the parallel controller is if you want to fetch the token from a previous request. It might not work.
Please correct me if I haven't understood the question correctly
Parallel Controller is not something you should be using, it's for simulating AJAX requests as JMeter cannot execute JavaScript like browser does and hence cannot run multiple HTTP request samplers in parallel with one virtual user.
Your test plan structure should be much simpler, to wit:
HTTP Request sampler (to get login page)
a Post-Processor (most probably you're looking for CSS Selector Extractor) to get the values from hidden fields
HTTP Request sampler (to perform login)
See Variabilize and Correlate the script chapter for more details on the concept

JMeter encoding issue on "application/soap+msbin1"

Working on JMeter and trying to send the soap request to server and shows the below error msg.
Error Msg:- Cannot process the message because the content type 'application/soap+msbin1' was not the expected type 'application/xml; charset=utf-8'.
We need help to encode XML to 'application/soap+msbin1' format.
Bit late to the party, but I encountered a similar issue - I had a template for SOAP request which uses embedded-binary XML (xop:Include cid="...") and had to scratch my head to figure out how to do that with the stock HTTP Request.
The answer: you can't - not in a simple way. To solve the issue, I ended up customizing JMeter (I also looked at HTTPRawRequest as well but it doesn't seem to support https and I would have to rewrite a lot of the test script to use that). Since HTTP request does 99% of the job, the quickest way to support binary data is to change the source code to handle binary data.
The main issues are two: the Function interface in JMeter is designed around returning String, not byte[]. So already __FileToString() (which I used to read an external binary file to use) encodes the content of the file . Secondly, the HTTP Request Sampler and HTTPHC4Impl itself (excluding the "upload file" bit) encodes the parts of the HTTP request before sending it over to the wire.
Changing that implied changes in Function, AbstractFunction, CompoundVariable and create a new function class FileToStringBinary which encode the binary data in a way that it can be decoded after (by changes made to HTTPHC4Impl).
If I have the time I'll find someplace where to post the idea and the source (can't submit to JMeter because my update to HTTPHC4Impl is limited to handle the specific requests I need to test, where the embedded binary is in a multipart/related part, and I have no time or inclination to handle the general cases), but if you still need help to make it work, drop a line.

Correlation in general for LoadRunner

In general could anything coming from the server be correlated? All unique values being recorded could be correlated as long as it is created server side and passed in the server response?
Spesific for correlating values in the http headers returned from the server one would use "scope=headers" right?
What kind of other values could "scope" have? I know of body, but are there others?
It is not possible to correlate values generated client side by i.e. a JavaScript?
Correlated values are returned from the server inside of the HTTP response stream. If you need a value from Javascript then you have a couple of paths
Convert your javascript function to the language of your virtual user (C, VB, Java, etc...)
Run truClient, which executes JavaScript as a full blown browser.

Resources