TCP/IP API in Jmeter - api

Can anyone please help on creating the TCP/IP API in Jmeter for the automation and load testing.
Below is the API call need to hit on Ip - 10.10.xx.xxx on port 4433
How to put these call in Jmeter for the scripting.
{
\"COMM_DAILY_TXN_LIMIT\":\"000001500000\",
\"COMM_MONTHLY_LIMIT_FLAG\":\"1\",
\"COMM_CODE_USD\":\"0\",
\"COMM_MER_TYPE\":\"\",
\"MCHIP_FLAG\":\"1\",
\"COMM_COD_POSTAL\":\"400001\",
\"MASTER_TRMN_TYPE\":\"0\",
\"RRN\":\"200\",
\"COMM_MONTHLY_LIMIT\":\"000015000000\",
\"TERMINAL_NUM\":\"0006019A\",
\"MONTHLY_TXN_LIMIT\":\"000015000000\",
\"COMM_KEY_ENTRY\":\"1\",
\"COMM_NUM_FAX\":\"9930197345\",
\"VSDC_FLAG\":\"1\",
\"TYPE\":\"3\",
\"PER_TXN_LIMIT_FLAG\":\"1\",
\"MASTERCARD_PAN\":\"\",
\"REQTYPE\":\"200\",
\"DEVICE_TYPE\":\"0\",
\"MONTHLY_LIMIT_UPD_FLAG\":\"1\",
\"COMM_ENSEIGNE\":\"VENK FINAL DBA\",
\"REQDT\":\"15052018110916\",
\"COMM_CODE_CATEG\":\"7011\",
\"MOBILE_NO\":\"\",
\"CAM_RELIABILITY_INDICATR\":\"1\",
\"COMM_NUM_COMM\":\"0450000A0000716\",
\"COMM_CODE_AG\":\"00045 \",
\"COMM_PER_TXN_LIMIT\":\"000000100000\",
\"CODE_MONNAIE\":\"356\",\"COMM_DAILY_LIMIT_UPD_FLAG\":\"1\",
\"COMM_INSTITUTION_FLAG\":\"0\",
\"RUPAY_PAN\":\"\",
\"COMM_TYPE_COMM\":\"S\",
\"TERMINAL_TYPE\":\"M\",
\"COMM_CODE_ANNUL\":\"1\",
\"DAILY_TXN_LIMIT\":\"000001500000\",
\"COMM_LOCALIS\":\"MUMBAI\",
\"COMM_INTR_BIN_FLAG\":\"0\",
\"VISA_PAN\":\"\",
\"DAILY_LIMIT_UPD_FLAG\":\"1\",
\"COMM_LIGNE1\":\"VENK FINAL LEGAL\",
\"COMM_PER_TXN_LIMIT_FLAG\":\"1\",
\"COMM_CODE_BNQ\":\"00045\",
\"COMM_TIER\":\"0\",
\"COMM_CODE_ECOMMERCE\":\"0\",
\"COMM_LIGNE2\":\"VENK FINAL LEGAL\",
\"PER_TXN_LIMIT\":\"000000100000\",
\"MOBILE_NO1\":\"\",
\"COMM_COD_PAYS\":\"356\",
\"MOBILE_NO4\":\"\",
\"MOBILE_NO5\":\"\",
\"MOBILE_NO2\":\"\",
\"PIN_ENCRYPTION_TYPE\":\"1\",
\"SPECIAL_KEY_ENTRY\":\"1\",
\"AMEX_MID\":\"\",
\"MOBILE_NO3\":\"\",
\"USER\":\"MRLPAY\",
\"PAYWAVE_PAYPASS_FLAG\":\"0\",
\"COMM_ADRES1\":\"202AVANMALI\",
\"ACTION\":\"C\",
\"BANKCODE\":\"00045\",
\"COMM_ONLY_CASH_AT_POS_FLAG\":\"0\",
\"COMM_ADRES2\":\"VKPATILMARG\",
\"COMM_ADRES3\":\"VKPATILMARG\",
\"ACTIVITY\":\"1\",
\"LINE_ENCRYPT_TERM\":\"4\",
\"COMM_IRD_FLAG\":\"0\"
}

Add HTTP Request sampler to your Test Plan
Put 10.10.xx.xxx into "Server Name or IP" input
Put 4443 into "Port Number"
Most probably you will need to type https into "Protocol"
Most probably you will need to change "Method" to POST
Most probably you will need to add a HTTP Header Manager and configure it to send Content-Type header with the value of application/json
Refer to REST API Testing - How to Do it Right article if you need more information.

Related

In karate mocking (karate-netty), how can we override request header value?

Objective:
We want few API calls should go to mock-server(https://192.x.x.x:8001) and others should go to an actual downstream application server(https://dev.api.acme.com).
Setup :
On local, mock server is up with standalone jar on port 8001. e.g https://192.x.x.x:8001
In application config file (config.property)downstream system(which need to mock) defined with mockserver IP i.e https://192.x.x.x:8001
Testing scenario and problem:
1.
Scenario: pathMatches('/profile/v1/users/{id}/user')
* karate.proceed('https://dev.api.acme.com')
* def response = read ('findScope.json')
* def responseStatus = 200ˀˀ
* print 'created response is: ' + response
Now, when we hit API request via postman or feature file then it does karate.proceed properly to https://dev.api.acme.com/profile/v1/users/123/user instead of 192.x.x.x. However, in this request, host is referring to https://192.x.x.x:8001 instead of https://dev.api.acme.com which create a problem for us.
How can we override request header in this case? I did try with karate.set and also with header host=https://192.x.x.x:8001 but no luck.
Thanks!
Please see if the 1.0 version works: https://github.com/intuit/karate/wiki/1.0-upgrade-guide
Unfortunately https proxying may not work as mentioned. If you are depending on this, we may need your help (code contribution) to get this working
If the Host header is still not mutable, that also can be considered a feature request, and here also I'd request you to consider contributing code

How to extract sessionId from Citrus HttpRequest

I tried to test the a set of REST services using Citrus Java DSL. After authentication the services expect the same, valid session id of the first request.
On the server side I can see, that there exists a random session-id, but at the second request, the session-id is null.
I've tried to set handleCookies to true in the endpoint configuration and tried to extract some header information (set-cookie) but without success. The EndpointConfiguration is reused during the different requests.
CitrusEndpoints.http()
.client()
.handleCookies(true)
How can I force the Endpoint to reuse the negotiated session-id or how can I extract it from the request / response?
Thanks in advance for any ideas and hints.
The response to your 1st request should have a header set
Set-Cookie: JSESSIONID=ABCDEFG;path=/api/foo
You can extract this information in your receive operation
http()
.client(todoClient)
.receive()
.response(HttpStatus.OK)
.extractFromHeader("Set-Cookie", "cookie")
.payload("{ \"foo\": \"bar\" }");
After that we have to post process the new ${cookie} value in order to extract the actual session id name and value into a new variable ${sessionId}.
createVariable("sessionId", "citrus:substringBefore(${cookie}, ';')");
Now we have a variable ${sessionId} that only contains the name and value of the session id - in our example this is JSESSIONID=ABCDEFG.
In further requests you can use the variable in order to set proper Cookie header information
http()
.client(todoClient)
.send()
.get("/api/foo")
.header("Cookie", "${sessionId}")
.accept(ContentType.APPLICATION_JSON.getMimeType());

SoftLayer REST API get Bandwidth Data By Date

I have a question regarding the use of the getBandwidthDataByDate request using the SoftLayer REST API.
In the documentation it lists 3 parameters for this request, but it's a GET request. Does anyone know how to make this request and/or have an example?
https://api.softlayer.com/rest/v3/SoftLayer_Virtual_Guest/getBandwidthDataByDate/'device_id'.json
I'm not sure where to add the parameters here.(startDateTime, endDateTime, networkType)
And what does the dateTime object look like?
Thanks
This is a POST request, so you need to pass the parameters in "Payload" (I'm using Advanced REST client for Chrome).
Try the following REST request:
https://$user:$apiKey#api.softlayer.com/rest/v3/SoftLayer_Virtual_Guest/$device_id/getBandwidthDataByDate
Method: Post (Copy the below code in "Payload")
{
"parameters":[
"2016-03-10T00:00:00",
"2016-03-15T00:00:00",
"public"
]
}
Note: Replace $user, $apiKey and $device_id with your own information
References:
SoftLayer_Virtual_Guest::getBandwidthDataByDate

CFX will hijack \services URL, how to disable or config it?

See http://cxf.apache.org/docs/jaxrs-services-description.html#JAXRSServicesDescription-ServicelistingsandWADLqueries,
If you input URL like http://localhost:8080/store/books/services, CFX will hijack the URL and return some service description.
But in my case, the URL http://localhost:8080/store/books/services should be one of my webservice URL. How can I disable CFX's hijack?
By carefully reading the CFX document http://cxf.apache.org/docs/jaxrs-services-description.html#JAXRSServicesDescription-ServicelistingsandWADLqueries again,
I know that CFX has the ability to configure service list URL:
Note that you can override the location at which listings are provided (in case you would like '/services' be available to your resources) using 'service-list path' CXFServlet parameter, example:
'service-list-path' = '/listings'
That is a org.apache.cxf.transport.servlet.CXFServlet parameter.

jmeter help - test around polling /w meta refresh

I am new to jmeter and am working on putting together a test plan. The hurdle I've encountered is as follows:
First, a POST is made to processForm.aspx
Then, the user is redirected to pleaseWait.aspx
This page either redirects immediately to results.aspx OR loads, with a META REFRESH tag set to refresh in 5 seconds (and this step is repeated).
Now -- I can get this to execute by doing the following:
HTTP Sampler POST to processForm.aspx
Assert Response contains "<something on pleaseWait.aspx>"
While LAST
HTTP Sampler GET to pleaseWait.aspx
Assert Response contains "<something on results.aspx>"
However -- I don't care for this method, because it results in failed assertions (even though things are working as expected). I am sure there must be some other way to do this? Anyone more familiar with JMeter than I?
UPDATE:
Got it going by using Regular Expression Extractor instead of Assertions.
1) Add a User Defined Variables section at Test Plan Root
2) Add a variable to it "LoginWait" and "false"
HTTP Sampler POST to processForm.aspx
RegEx Extract Response Body contains "<something on pleaseWait.aspx>" into LoginWait
While ${LoginWait}
HTTP Sampler GET to pleaseWait.aspx
RegEx Extract Response Body contains "<something on pleaseWait.aspx>" into LoginWait
...
You could try using "follow redirects" on your HTTP Request. It would eliminate the logic you need, and still get you to the page you're going.