Is there an option in karate framework to print the request payload with CURL syntax in the test report - karate

when there are failures in your test report, sometimes you want to test the api with different parameters to see the behaviour. to do that, it will be easy if the test report contains the request with CURL syntax , so that you can just copy and import to postman and hit it in seconds instead of copying URL, headers, body separately.
Currently I use cucumber reports, and only see the request details logged in plain format

Unfortunately this is not an option currently.

Related

In Jmeter, I am not passing one value in request body but that value showing in response

In Jmeter, I am not passing one value in request body but that value showing in response. When I pass different value in script that time also any values not showing in response.if you are provide solutions that would be great.
PS: Application options are full of drop down boxes. In Default some values are selected
Would be great if you show how did you "pass" the value and how exactly it's "showing" in the response.
JMeter doesn't know anything about drop-down boxes, it sends a HTTP request, waits for the response and measures the time in between.
You can use your browser developer tools to see how various values in the drop-down boxes are reflected in the generated HTTP request parameters or record the requests(s) you need to simulate using JMeter's HTTP(S) Test Script Recorder or JMeter Chrome Extension.
The fact that the value is "showing" in response doesn't necessary mean that it's visible to the end user because it might be hidden by CSS.

Replicating POST request in POSTMAN

I'm trying to use Postman and replicate the following POST request from this link:
https://www.msc.com/en/track-a-shipment?params=dHJhY2tpbmdOdW1iZXI9YXNkYSZ0cmFja2luZ01vZGU9MA%3D%3D
The payload necessary to get a response from this API is something like:
{trackingNumber: "asda", trackingMode: "0"}
With the following payload, I expect to receive the following response:
{IsSuccess: false, Data: "Container not found"}
Here, you can see my Postman request:
All I seem to get from this is an empty string, which is not the same result I would see If I checked my Network tab from developer tools.
I'm wondering what do I need to do in order to get the same result. Change headers? Change payload format? What else could it be?
The request works for me, what's the difference that depends. But the easiest way to find the correct answer is to import the request as is from the Developer Tools.
Find the request on the request list and click Copy as cURL (bash):
Then on Postman click Import (top left main window) and select the Raw Text option:
The request will be on the current window and you can just click Send:
So you can now diff your request with this one. There's a lot of headers so I would remove them one by one and see where the request fails. Without having the API at hand, this is really a trial-and-error exercise.
Hope this helps.

How to get csrf token in Jmeter to use for log-in

I'm trying a log-in scenario for a page, but it's getting an error because of the csrf_token and other dynamic parameters that are being generated every time I run the test. How do I get these csrf_token and these parameters to use in my test?
Please see image below.
Request Header parameters
Jmeter Parameters
Error detail
Thanks,
You need to extract it from the previous response using a suitable Post-Processor, store it into a JMeter Variable and replace the recorded value with the variable.
The process is known as "correlation" and there is a lot of information on the topic over the web, for example How to Load Test CSRF-Protected Web Sites article would be a good starting point.

Katalon - Verifying form data by checking the network request

I am using a Katalon tool + groovy scripts for UI automation.
The page I would like to test has a number of filter fields of a different types (text fields, date pickers, etc.) and submit button that sends the request to the server.
I wasn't able to find any relevant information for the following issue:
is it possible to get the request that was sent by the browser to the server in order to parse and verify the parameters values?
Thanks in advance,
IM
I think you have to distinguish between UI and API Testing. For UI-Test you have to check the behaviour of UI and the correctness of all elements that are displayed.
With API Testing you can verify that your request are receiving correct status codes and responses for different sent form data.
For API Testing see https://docs.katalon.com/katalon-studio/tutorials/introduction_api_testing.html#what-is-api-testing

Capturing Postman requests in a report

I was checking on Postman and newman and how to automate the api testing. I have checked on assertions and the report generations that show results of assertion failures and pass status. We can check the status code by writing a an assertion. But is there a way where in we can capture the request and response directly for an api and generate a report that shows (say) 3 apis were tested and the requests agve 200 for first call 201 fro second an d then 400 for third without writing any assertions. The overall result will show request url and corresponding response code for the api.
This will be helpful in a way when we run a collection and then can see a html report stating the response code corresponding to the request url.
Thank you all in advance for your patience reading and extremely helpful insight to the problem. Thank You.
this already exists in Postman, through its command line interface Newman.
Have a look here and here as well.
You'll be able to set options, depending on the kind of reports you want.
Personaly I can use newman in TFS and get JUnit style reports that fit for my continuous integration purpose. You can generate also HTML reports.
Check the different options.
To handle response data, have a look here :
This takes place in the Tests tab of the Postman request, though
You can obtain informations about HTTP code (responseCode.code), description (responseCode.detail), etc.
You can also parse the JSON body to get more information
var jsonData = JSON.parse(responseBody);
You can output this data in the console